Search in sources :

Example 1 with ForeignType

use of org.whole.lang.models.model.ForeignType in project whole by wholeplatform.

the class ModelsJavaModelGeneratorVisitor method visit.

public void visit(SupertypesOf entity) {
    List<String> types = new ArrayList<String>();
    AbstractPatternFilterIterator<SimpleName> i = IteratorFactory.<SimpleName>childMatcherIterator().withPattern(ModelsEntityDescriptorEnum.SimpleName);
    i.reset(entity.getTypes());
    for (SimpleName name : i) types.add(name.wStringValue());
    ForeignType foreignType = entity.getForeignType();
    if (Matcher.matchImpl(ModelsEntityDescriptorEnum.AnyType, foreignType))
        modelsGen.entityDescriptorEnumBuilder().addSetAssignableFromAll(types.toArray(new String[types.size()]));
    else
        modelsGen.entityDescriptorEnumBuilder().addSetAssignableFromForeignType(foreignType.wStringValue(), types.toArray(new String[types.size()]));
}
Also used : ForeignType(org.whole.lang.models.model.ForeignType) SimpleName(org.whole.lang.models.model.SimpleName) ArrayList(java.util.ArrayList)

Example 2 with ForeignType

use of org.whole.lang.models.model.ForeignType in project whole by wholeplatform.

the class ModelsJavaModelGeneratorVisitor method visit.

public void visit(SubtypesOf entity) {
    List<String> types = new ArrayList<String>();
    AbstractPatternFilterIterator<SimpleName> i = IteratorFactory.<SimpleName>childMatcherIterator().withPattern(ModelsEntityDescriptorEnum.SimpleName);
    i.reset(entity.getTypes());
    for (SimpleName name : i) types.add(name.wStringValue());
    ForeignType foreignType = entity.getForeignType();
    if (Matcher.matchImpl(ModelsEntityDescriptorEnum.AnyType, foreignType))
        modelsGen.entityDescriptorEnumBuilder().addSetAssignableToAll(types.toArray(new String[types.size()]));
    else
        modelsGen.entityDescriptorEnumBuilder().addSetAssignableToForeignType(foreignType.wStringValue(), types.toArray(new String[types.size()]));
}
Also used : ForeignType(org.whole.lang.models.model.ForeignType) SimpleName(org.whole.lang.models.model.SimpleName) ArrayList(java.util.ArrayList)

Aggregations

ArrayList (java.util.ArrayList)2 ForeignType (org.whole.lang.models.model.ForeignType)2 SimpleName (org.whole.lang.models.model.SimpleName)2