Search in sources :

Example 96 with AegisType

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

the class ValueCompositeCxfType method getOrCreateAegisType.

private AegisType getOrCreateAegisType(Type type, XmlSchema root) {
    AegisType nested = getTypeMapping().getType(type);
    if (nested == null) {
        nested = createType(type, root);
        nested.writeSchema(root);
    }
    return nested;
}
Also used : AegisType(org.apache.cxf.aegis.type.AegisType)

Example 97 with AegisType

use of org.apache.cxf.aegis.type.AegisType 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 : 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

AegisType (org.apache.cxf.aegis.type.AegisType)97 QName (javax.xml.namespace.QName)43 Test (org.junit.Test)40 AbstractAegisTest (org.apache.cxf.aegis.AbstractAegisTest)35 DatabindingException (org.apache.cxf.aegis.DatabindingException)18 AegisContext (org.apache.cxf.aegis.AegisContext)16 TypeMapping (org.apache.cxf.aegis.type.TypeMapping)11 Element (org.w3c.dom.Element)11 Context (org.apache.cxf.aegis.Context)10 BeanType (org.apache.cxf.aegis.type.basic.BeanType)10 Method (java.lang.reflect.Method)9 MessageReader (org.apache.cxf.aegis.xml.MessageReader)9 TypeCreationOptions (org.apache.cxf.aegis.type.TypeCreationOptions)8 BeanTypeInfo (org.apache.cxf.aegis.type.basic.BeanTypeInfo)8 CollectionType (org.apache.cxf.aegis.type.collection.CollectionType)8 HashSet (java.util.HashSet)7 MapType (org.apache.cxf.aegis.type.collection.MapType)7 MessageWriter (org.apache.cxf.aegis.xml.MessageWriter)7 ElementReader (org.apache.cxf.aegis.xml.stax.ElementReader)7 XMLStreamWriter (javax.xml.stream.XMLStreamWriter)5