use of org.apache.cxf.aegis.type.basic.BeanTypeInfo 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.BeanTypeInfo in project cxf by apache.
the class CustomMappingTest method testInheritedMapping.
@Test
public void testInheritedMapping() throws Exception {
BeanTypeInfo bti = new BeanTypeInfo(GregorianCalendar.class, "http://util.java");
BeanType beanType = new BeanType(bti);
beanType.setSchemaType(new QName("http://util.java{GregorianCalendar}"));
AegisContext context = new AegisContext();
context.initialize();
TypeMapping mapping = context.getTypeMapping();
// we are replacing the default mapping.
mapping.register(beanType);
XmlSchema schema = newXmlSchema("http://util.java");
beanType.writeSchema(schema);
// well, test?
}
use of org.apache.cxf.aegis.type.basic.BeanTypeInfo in project cxf by apache.
the class NoDefaultConstructorBeanKeyType method readObject.
@Override
public Object readObject(MessageReader reader, Context context) throws DatabindingException {
BeanTypeInfo inf = getTypeInfo();
try {
String key = null;
// Read child elements
while (reader.hasMoreElementReaders()) {
MessageReader childReader = reader.getNextElementReader();
if (childReader.isXsiNil()) {
childReader.readToEnd();
continue;
}
QName name = childReader.getName();
AegisType defaultType = inf.getType(name);
AegisType type = TypeUtil.getReadType(childReader.getXMLStreamReader(), context.getGlobalContext(), defaultType);
if (type != null) {
String value = (String) type.readObject(childReader, context);
if ("key".equals(name.getLocalPart())) {
key = value;
}
} else {
childReader.readToEnd();
}
}
return new NoDefaultConstructorBeanKeyImpl(key);
} catch (IllegalArgumentException e) {
throw new DatabindingException("Illegal argument. " + e.getMessage(), e);
}
}
Aggregations