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());
}
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());
}
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();
}
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;
}
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;
}
Aggregations