return primitiveArrayContentHandler.getJaxbElement();
}
}
if(null != xmlDescriptor && null == getSchema()) {
RootLevelXmlAdapter adapter= null;
if(jaxbContext.getTypeMappingInfoToJavaTypeAdapters().size() >0){
adapter = jaxbContext.getTypeMappingInfoToJavaTypeAdapters().get(type);
}
UnmarshalRecord unmarshalRecord = (UnmarshalRecord) xmlDescriptor.getObjectBuilder().createRecord((AbstractSession) xmlUnmarshaller.getXMLContext().getSession(0));
XMLStreamReaderReader staxReader = new XMLStreamReaderReader(xmlUnmarshaller);
unmarshalRecord.setUnmarshaller(xmlUnmarshaller);
unmarshalRecord.setXMLReader(staxReader);
staxReader.setContentHandler(unmarshalRecord);
staxReader.parse(streamReader);
Object value = null;
if(unmarshalRecord.isNil()) {
value = null;
} else {
value = unmarshalRecord.getCurrentObject();
}
if(value instanceof WrappedValue){
value = ((WrappedValue)value).getValue();
}
if(value instanceof ManyValue){
value = ((ManyValue)value).getItem();
}
if(adapter != null) {
try {
value = adapter.getXmlAdapter().unmarshal(value);
} catch(Exception ex) {
throw new JAXBException(XMLMarshalException.marshalException(ex));
}
}
Class declaredClass = null;
if(type.getType() instanceof Class){
declaredClass = (Class)type.getType();
}else{
declaredClass = Object.class;
}
return new JAXBElement(new QName(unmarshalRecord.getRootElementNamespaceUri(), unmarshalRecord.getLocalName()), declaredClass, value);
}
if(jaxbContext.getTypeMappingInfoToGeneratedType() == null) {
return unmarshal(streamReader, type.getType());
}
RootLevelXmlAdapter adapter= null;
if(jaxbContext.getTypeMappingInfoToJavaTypeAdapters().size() >0){
adapter = jaxbContext.getTypeMappingInfoToJavaTypeAdapters().get(type);
}
Class unmarshalClass = null;
if(jaxbContext.getTypeMappingInfoToGeneratedType().size() >0){
unmarshalClass = jaxbContext.getTypeMappingInfoToGeneratedType().get(type);
}
if(unmarshalClass != null){
JAXBElement unmarshalled = unmarshal(streamReader, unmarshalClass);
Class declaredClass = null;
if(type.getType() instanceof Class){
declaredClass = (Class)type.getType();
}else{
declaredClass = Object.class;
}
Object value = unmarshalled.getValue();
if(adapter != null) {
try {
value = adapter.getXmlAdapter().unmarshal(value);
} catch(Exception ex) {
throw new JAXBException(XMLMarshalException.marshalException(ex));
}
}
JAXBElement returnVal = new JAXBElement(unmarshalled.getName(), declaredClass, unmarshalled.getScope(), value);
return returnVal;
}else if(type.getType() instanceof Class){
if(adapter != null) {
JAXBElement element = unmarshal(streamReader, adapter.getBoundType());
try {
Object value = adapter.getXmlAdapter().unmarshal(element.getValue());
element.setValue(value);
return element;
} catch(Exception ex) {
throw new JAXBException(XMLMarshalException.marshalException(ex));
}