use of org.apache.cxf.aegis.type.basic.BeanTypeInfo in project cxf by apache.
the class DefaultTypeCreator method createDefaultType.
@Override
public AegisType createDefaultType(TypeClassInfo info) {
BeanType type = new BeanType();
/*
* As of this point, we refuse to do this for generics in general.
* This might be revisited ... it might turn out to 'just work'.
*/
Class<?> typeClass = TypeUtil.getTypeClass(info.getType(), false);
if (typeClass == null) {
throw new DatabindingException("Unable to map generic type " + info.getType());
}
type.setSchemaType(createQName(typeClass));
type.setTypeClass(typeClass);
type.setTypeMapping(getTypeMapping());
BeanTypeInfo typeInfo = type.getTypeInfo();
typeInfo.setDefaultMinOccurs(getConfiguration().getDefaultMinOccurs());
typeInfo.setExtensibleAttributes(getConfiguration().isDefaultExtensibleAttributes());
typeInfo.setExtensibleElements(getConfiguration().isDefaultExtensibleElements());
return type;
}
use of org.apache.cxf.aegis.type.basic.BeanTypeInfo in project cxf by apache.
the class ArrayTypeInfoTest method setUp.
public void setUp() throws Exception {
super.setUp();
addNamespace("b", "urn:Bean");
addNamespace("a", "urn:anotherns");
addNamespace("xsi", Constants.URI_2001_SCHEMA_XSI);
AegisContext context = new AegisContext();
context.initialize();
mapping = context.getTypeMapping();
// address type
BeanTypeInfo addressInfo = new BeanTypeInfo(Address.class, "urn:Bean");
addressInfo.setTypeMapping(mapping);
addressType = new StructType(addressInfo);
addressType.setTypeClass(Address.class);
addressType.setSchemaType(new QName("urn:Bean", "addr"));
mapping.register(addressType);
}
use of org.apache.cxf.aegis.type.basic.BeanTypeInfo in project cxf by apache.
the class StructTypeTest method setUp.
public void setUp() throws Exception {
super.setUp();
// address type
BeanTypeInfo addressInfo = new BeanTypeInfo(Address.class, "urn:Bean");
addressInfo.setTypeMapping(mapping);
addressType = new StructType(addressInfo);
addressType.setTypeClass(Address.class);
addressType.setSchemaType(new QName("urn:Bean", "address"));
mapping.register(addressType);
// purchase order type
BeanTypeInfo poInfo = new BeanTypeInfo(PurchaseOrder.class, "urn:Bean");
poInfo.setTypeMapping(mapping);
purchaseOrderType = new StructType(poInfo);
purchaseOrderType.setTypeClass(PurchaseOrder.class);
purchaseOrderType.setTypeMapping(mapping);
purchaseOrderType.setSchemaType(new QName("urn:Bean", "po"));
mapping.register(purchaseOrderType);
}
use of org.apache.cxf.aegis.type.basic.BeanTypeInfo in project cxf by apache.
the class ConfigurationTest method testExtensibleDefaultFalse.
@Test
public void testExtensibleDefaultFalse() throws Exception {
config.setDefaultExtensibleElements(false);
config.setDefaultExtensibleAttributes(false);
AegisType type = tm.getTypeCreator().createType(AnnotatedBean1.class);
BeanTypeInfo info = ((BeanType) type).getTypeInfo();
assertFalse(info.isExtensibleElements());
assertFalse(info.isExtensibleAttributes());
}
use of org.apache.cxf.aegis.type.basic.BeanTypeInfo in project cxf by apache.
the class ConfigurationTest method testMinOccursDefault0.
@Test
public void testMinOccursDefault0() throws Exception {
config.setDefaultMinOccurs(0);
AegisType type = tm.getTypeCreator().createType(AnnotatedBean1.class);
BeanTypeInfo info = ((BeanType) type).getTypeInfo();
assertEquals(info.getMinOccurs(new QName(info.getDefaultNamespace(), "bogusProperty")), 0);
}
Aggregations