use of org.apache.cxf.aegis.type.basic.BeanTypeInfo in project cxf by apache.
the class ConfigurationTest method testNillableDefaultFalse.
@Test
public void testNillableDefaultFalse() throws Exception {
config.setDefaultNillable(false);
AegisType type = tm.getTypeCreator().createType(AnnotatedBean1.class);
BeanTypeInfo info = ((BeanType) type).getTypeInfo();
assertFalse(info.isNillable(new QName(info.getDefaultNamespace(), "bogusProperty")));
}
use of org.apache.cxf.aegis.type.basic.BeanTypeInfo in project cxf by apache.
the class ConfigurationTest method testNillableDefaultTrue.
@Test
public void testNillableDefaultTrue() throws Exception {
config.setDefaultNillable(true);
AegisType type = tm.getTypeCreator().createType(AnnotatedBean1.class);
BeanTypeInfo info = ((BeanType) type).getTypeInfo();
assertTrue(info.isNillable(new QName(info.getDefaultNamespace(), "bogusProperty")));
}
use of org.apache.cxf.aegis.type.basic.BeanTypeInfo in project cxf by apache.
the class ConfigurationTest method testMinOccursDefault1.
@Test
public void testMinOccursDefault1() throws Exception {
config.setDefaultMinOccurs(1);
AegisType type = tm.getTypeCreator().createType(AnnotatedBean1.class);
BeanTypeInfo info = ((BeanType) type).getTypeInfo();
assertEquals(info.getMinOccurs(new QName(info.getDefaultNamespace(), "bogusProperty")), 1);
}
use of org.apache.cxf.aegis.type.basic.BeanTypeInfo in project cxf by apache.
the class NoDefaultConstructorBeanType method readObject.
@Override
public Object readObject(MessageReader reader, Context context) throws DatabindingException {
BeanTypeInfo inf = getTypeInfo();
try {
String id = null;
String name = null;
// Read child elements
while (reader.hasMoreElementReaders()) {
MessageReader childReader = reader.getNextElementReader();
if (childReader.isXsiNil()) {
childReader.readToEnd();
continue;
}
QName qName = childReader.getName();
AegisType defaultType = inf.getType(qName);
AegisType type = TypeUtil.getReadType(childReader.getXMLStreamReader(), context.getGlobalContext(), defaultType);
if (type != null) {
String value = (String) type.readObject(childReader, context);
if ("id".equals(qName.getLocalPart())) {
id = value;
} else if ("name".equals(qName.getLocalPart())) {
name = value;
}
} else {
childReader.readToEnd();
}
}
return new NoDefaultConstructorBeanImpl(id, name);
} catch (IllegalArgumentException e) {
throw new DatabindingException("Illegal argument. " + e.getMessage(), e);
}
}
use of org.apache.cxf.aegis.type.basic.BeanTypeInfo in project cxf by apache.
the class SoapArrayTypeTest method setUp.
public void setUp() throws Exception {
super.setUp();
// address type
BeanTypeInfo addressInfo = new BeanTypeInfo(Address.class, "urn:Bean");
addressInfo.setTypeMapping(mapping);
StructType 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);
StructType purchaseOrderType = new StructType(poInfo);
purchaseOrderType.setTypeClass(PurchaseOrder.class);
purchaseOrderType.setTypeMapping(mapping);
purchaseOrderType.setSchemaType(new QName("urn:Bean", "po"));
mapping.register(purchaseOrderType);
// String[][][]
SoapArrayType arrayOfString = createArrayType(String[].class, new QName("urn:Bean", "SOAPArrayOfString"));
mapping.register(arrayOfString);
SoapArrayType arrayOfArrayOfString = createArrayType(String[][].class, new QName("urn:Bean", "SOAPArrayOfArrayOfString"));
mapping.register(arrayOfArrayOfString);
SoapArrayType arrayOfArrayOfArrayOfString = createArrayType(String[][][].class, new QName("urn:Bean", "SOAPArrayOfArrayOfArrayOfString"));
mapping.register(arrayOfArrayOfArrayOfString);
// int[][]
SoapArrayType arrayOfInt = createArrayType(int[].class, new QName("urn:Bean", "SOAPArrayOfInt"));
mapping.register(arrayOfInt);
SoapArrayType arrayOfArrayOfInt = createArrayType(int[][].class, new QName("urn:Bean", "SOAPArrayOfArrayOfInt"));
mapping.register(arrayOfArrayOfInt);
// Object[]
SoapArrayType arrayOfAddress = createArrayType(Address[].class, new QName("urn:Bean", "SOAPArrayOfAddress"));
mapping.register(arrayOfAddress);
SoapArrayType arrayOfAny = createArrayType(Object[].class, new QName("urn:Bean", "SOAPArrayOfAny"));
mapping.register(arrayOfAny);
}
Aggregations