Search in sources :

Example 1 with CollectionType

use of org.apache.cxf.aegis.type.collection.CollectionType in project qi4j-sdk by Qi4j.

the class ValueCompositeCxfType method createType.

private AegisType createType(Type type, XmlSchema root) {
    if (isCollection(type)) {
        AegisType componentType = getOrCreateAegisType(getCollectionComponentType(type), root);
        CollectionType resultType = new CollectionType(componentType);
        QName schemaType = new QName("http://www.w3.org/2001/XMLSchema", "list");
        resultType.setSchemaType(schemaType);
        return resultType;
    } else if (isMap(type)) {
        AegisType keyType = getOrCreateAegisType(getMapKeyComponentType(type), root);
        AegisType valueType = getOrCreateAegisType(getMapValueComponentType(type), root);
        QName schemaType = new QName(Classes.toURI(Classes.RAW_CLASS.map(type)), "map");
        return new MapType(schemaType, keyType, valueType);
    } else if (isValueComposite(type)) {
        ValueCompositeCxfType aegisType = module.newObject(ValueCompositeCxfType.class, getTypeMapping(), type);
        getTypeMapping().register(aegisType);
        return aegisType;
    } else {
        throw new NoSuchValueException(type.toString(), module.name());
    }
}
Also used : NoSuchValueException(org.qi4j.api.value.NoSuchValueException) AegisType(org.apache.cxf.aegis.type.AegisType) QName(javax.xml.namespace.QName) CollectionType(org.apache.cxf.aegis.type.collection.CollectionType) MapType(org.apache.cxf.aegis.type.collection.MapType)

Aggregations

QName (javax.xml.namespace.QName)1 AegisType (org.apache.cxf.aegis.type.AegisType)1 CollectionType (org.apache.cxf.aegis.type.collection.CollectionType)1 MapType (org.apache.cxf.aegis.type.collection.MapType)1 NoSuchValueException (org.qi4j.api.value.NoSuchValueException)1