use of org.apache.cxf.aegis.custom.service.NoDefaultConstructorBeanImpl 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);
}
}
Aggregations