Search in sources :

Example 21 with BeanType

use of org.apache.cxf.aegis.type.basic.BeanType in project cxf by apache.

the class AnnotatedTypeTest method testExtensibilityOff.

@Test
public void testExtensibilityOff() {
    BeanType type = (BeanType) tm.getTypeCreator().createType(AnnotatedBean4.class);
    assertFalse(type.getTypeInfo().isExtensibleElements());
    assertFalse(type.getTypeInfo().isExtensibleAttributes());
}
Also used : BeanType(org.apache.cxf.aegis.type.basic.BeanType) Test(org.junit.Test) AbstractAegisTest(org.apache.cxf.aegis.AbstractAegisTest)

Example 22 with BeanType

use of org.apache.cxf.aegis.type.basic.BeanType in project cxf by apache.

the class ConfigurationTest method testExtensibleDefaultTrue.

@Test
public void testExtensibleDefaultTrue() throws Exception {
    config.setDefaultExtensibleElements(true);
    config.setDefaultExtensibleAttributes(true);
    AegisType type = tm.getTypeCreator().createType(AnnotatedBean1.class);
    BeanTypeInfo info = ((BeanType) type).getTypeInfo();
    assertTrue(info.isExtensibleElements());
    assertTrue(info.isExtensibleAttributes());
}
Also used : BeanTypeInfo(org.apache.cxf.aegis.type.basic.BeanTypeInfo) AegisType(org.apache.cxf.aegis.type.AegisType) BeanType(org.apache.cxf.aegis.type.basic.BeanType) Test(org.junit.Test) AbstractAegisTest(org.apache.cxf.aegis.AbstractAegisTest)

Example 23 with BeanType

use of org.apache.cxf.aegis.type.basic.BeanType in project cxf by apache.

the class SoapArrayType method writeValue.

protected void writeValue(Object value, MessageWriter writer, Context context, AegisType type) throws DatabindingException {
    type = TypeUtil.getWriteType(context.getGlobalContext(), value, type);
    MessageWriter cwriter = writer.getElementWriter(type.getSchemaType().getLocalPart(), "");
    if (value == null && type.isNillable()) {
        // null
        cwriter.writeXsiNil();
    } else if (type instanceof BeanType || type instanceof SoapArrayType) {
        // write refs to complex type
        String refId = MarshalRegistry.get(context).getInstanceId(value);
        SoapEncodingUtil.writeRef(cwriter, refId);
    } else {
        // write simple types inline
        type.writeObject(value, cwriter, context);
    }
    cwriter.close();
}
Also used : BeanType(org.apache.cxf.aegis.type.basic.BeanType) MessageWriter(org.apache.cxf.aegis.xml.MessageWriter)

Example 24 with BeanType

use of org.apache.cxf.aegis.type.basic.BeanType in project cxf by apache.

the class StructType method superBeanType.

private BeanType superBeanType(AegisType t) {
    if (t instanceof BeanType) {
        BeanType bt = (BeanType) t;
        AegisType supertype = bt.getSuperType();
        if (supertype instanceof BeanType) {
            return (BeanType) supertype;
        }
    }
    return null;
}
Also used : BeanType(org.apache.cxf.aegis.type.basic.BeanType) AegisType(org.apache.cxf.aegis.type.AegisType)

Example 25 with BeanType

use of org.apache.cxf.aegis.type.basic.BeanType in project cxf by apache.

the class Java5TypeCreator method createDefaultType.

@Override
public AegisType createDefaultType(TypeClassInfo info) {
    QName typeName = info.getTypeName();
    Class<?> relatedClass = TypeUtil.getTypeRelatedClass(info.getType());
    if (typeName == null) {
        typeName = createQName(relatedClass);
    }
    AnnotatedTypeInfo typeInfo = new AnnotatedTypeInfo(getTypeMapping(), relatedClass, typeName.getNamespaceURI(), getConfiguration());
    typeInfo.setExtensibleElements(annotationReader.isExtensibleElements(relatedClass, getConfiguration().isDefaultExtensibleElements()));
    typeInfo.setExtensibleAttributes(annotationReader.isExtensibleAttributes(relatedClass, getConfiguration().isDefaultExtensibleAttributes()));
    typeInfo.setDefaultMinOccurs(getConfiguration().getDefaultMinOccurs());
    typeInfo.setDefaultNillable(getConfiguration().isDefaultNillable());
    BeanType type = new BeanType(typeInfo);
    type.setTypeMapping(getTypeMapping());
    type.setSchemaType(typeName);
    return type;
}
Also used : BeanType(org.apache.cxf.aegis.type.basic.BeanType) QName(javax.xml.namespace.QName)

Aggregations

BeanType (org.apache.cxf.aegis.type.basic.BeanType)26 AbstractAegisTest (org.apache.cxf.aegis.AbstractAegisTest)19 Test (org.junit.Test)19 QName (javax.xml.namespace.QName)17 AegisType (org.apache.cxf.aegis.type.AegisType)8 BeanTypeInfo (org.apache.cxf.aegis.type.basic.BeanTypeInfo)8 TypeCreationOptions (org.apache.cxf.aegis.type.TypeCreationOptions)3 MessageWriter (org.apache.cxf.aegis.xml.MessageWriter)2 GenericArrayType (java.lang.reflect.GenericArrayType)1 ParameterizedType (java.lang.reflect.ParameterizedType)1 AegisContext (org.apache.cxf.aegis.AegisContext)1 DatabindingException (org.apache.cxf.aegis.DatabindingException)1 TypeMapping (org.apache.cxf.aegis.type.TypeMapping)1 TypeUtil (org.apache.cxf.aegis.type.TypeUtil)1 XMLBeanTypeInfo (org.apache.cxf.aegis.type.basic.XMLBeanTypeInfo)1 XmlSchema (org.apache.ws.commons.schema.XmlSchema)1 Element (org.w3c.dom.Element)1