Search in sources :

Example 1 with UnionMapping

use of org.whole.lang.xsd.mapping.model.UnionMapping in project whole by wholeplatform.

the class CompiledMappingStrategy method getUnionEntityMappings.

public Collection<EntityDescriptor<?>> getUnionEntityMappings(EntityDescriptor<?> context) {
    // TODO optimize
    String contextURI = unparseEntityDescriptor(context);
    AbstractPatternFilterIterator<UnionMapping> i2 = IteratorFactory.<UnionMapping>childMatcherIterator().withPattern(UnionMapping);
    i2.reset(strategy.getMappings());
    for (UnionMapping mapping : i2) if (contextURI.equals(mapping.getContextEntityType().getValue())) {
        Types unionTypes = mapping.getUnionTypes();
        int size = unionTypes.wSize();
        List<EntityDescriptor<?>> list = new ArrayList<EntityDescriptor<?>>(size);
        for (int i = 0; i < size; i++) list.add(parseEntityDescriptor(unionTypes.wGet(i).wStringValue()));
        return list;
    }
    return Collections.emptyList();
}
Also used : Types(org.whole.lang.xsd.mapping.model.Types) SchemaDataTypes(org.whole.lang.xsd.parsers.SchemaDataTypes) EntityDescriptor(org.whole.lang.reflect.EntityDescriptor) ArrayList(java.util.ArrayList) List(java.util.List) UnionMapping(org.whole.lang.xsd.mapping.model.UnionMapping)

Aggregations

ArrayList (java.util.ArrayList)1 List (java.util.List)1 EntityDescriptor (org.whole.lang.reflect.EntityDescriptor)1 Types (org.whole.lang.xsd.mapping.model.Types)1 UnionMapping (org.whole.lang.xsd.mapping.model.UnionMapping)1 SchemaDataTypes (org.whole.lang.xsd.parsers.SchemaDataTypes)1