Class JAXBUnmarshaller
- java.lang.Object
-
- org.eclipse.persistence.jaxb.JAXBUnmarshaller
-
- All Implemented Interfaces:
Unmarshaller
public class JAXBUnmarshaller extends java.lang.Object implements Unmarshaller
INTERNAL:Purpose:To Provide an implementation of the JAXB 2.0 Unmarshaller Interface
Responsibilities:
- Provide a JAXB wrapper on the XMLUnmarshaller API
- Perform XML to Object Conversions
This implementation of the JAXB 2.1/2.2 Unmarshaller interface provides the required functionality by acting as a thin wrapper on the existing XMLMarshaller API.
- See Also:
Unmarshaller,UnmarshallerProperties,XMLUnmarshaller- Author:
- mmacivor
- Since:
- Oracle TopLink 11.1.1.0.0
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface javax.xml.bind.Unmarshaller
Unmarshaller.Listener
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringSTAX_SOURCE_CLASS_NAMEstatic java.lang.StringXML_JAVATYPE_ADAPTERS
-
Constructor Summary
Constructors Constructor Description JAXBUnmarshaller(XMLUnmarshaller newXMLUnmarshaller, JAXBContext jaxbContext)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description XmlAdaptergetAdapter(java.lang.Class javaClass)Gets the adapter associated with the specified type.AttachmentUnmarshallergetAttachmentUnmarshaller()java.util.Set<ConstraintViolationWrapper<java.lang.Object>>getConstraintViolations()Returns constraint violations stored in the underlyingJAXBBeanValidatorinstance.ValidationEventHandlergetEventHandler()Return the current event handler or the default event handler if one hasn't been set.IDResolvergetIDResolver()Return this Unmarshaller's custom IDResolver.JAXBContextgetJaxbContext()Unmarshaller.ListenergetListener()ReturnUnmarshaller.Listenerregistered with thisUnmarshaller.java.lang.ObjectgetProperty(java.lang.String key)Get a property from the JAXBMarshaller.javax.xml.validation.SchemagetSchema()Get the JAXP 1.3Schemaobject being used to perform unmarshal-time validation.UnmarshallerHandlergetUnmarshallerHandler()Get an unmarshaller handler object that can be used as a component in an XML pipeline.XMLUnmarshallergetXMLUnmarshaller()booleanisValidating()Indicates whether or not theUnmarshalleris configured to validate during unmarshal operations.voidsetAdapter(java.lang.Class javaClass, XmlAdapter adapter)Associates a configured instance ofXmlAdapterwith this unmarshaller.voidsetAdapter(XmlAdapter adapter)Associates a configured instance ofXmlAdapterwith this unmarshaller.voidsetAttachmentUnmarshaller(AttachmentUnmarshaller unmarshaller)Associate a context that resolves cid's, content-id URIs, to binary data passed as attachments.voidsetEventHandler(ValidationEventHandler newValidationEventHandler)Allow an application to register aValidationEventHandler.voidsetIDResolver(IDResolver idResolver)Set this Unmarshaller's custom IDResolver.voidsetListener(Unmarshaller.Listener listener)Register unmarshal event callbackUnmarshaller.Listenerwith thisUnmarshaller.voidsetProperty(java.lang.String key, java.lang.Object value)Set a property on the JAXBUnmarshaller.voidsetSchema(javax.xml.validation.Schema schema)Specify the JAXP 1.3Schemaobject that should be used to validate subsequent unmarshal operations against.voidsetUnmarshalCallbacks(java.util.Map callbacks)voidsetValidating(boolean validate)Specifies whether or not the default validation mechanism of theUnmarshallershould validate during unmarshal operations.java.lang.Objectunmarshal(java.io.File file)Unmarshal XML data from the specified file and return the resulting content tree.java.lang.Objectunmarshal(java.io.InputStream inputStream)Unmarshal XML data from the specified InputStream and return the resulting content tree.java.lang.Objectunmarshal(java.io.Reader reader)Unmarshal XML data from the specified Reader and return the resulting content tree.java.lang.Objectunmarshal(java.net.URL url)Unmarshal XML data from the specified URL and return the resulting content tree.java.lang.Objectunmarshal(javax.xml.stream.XMLEventReader eventReader)Unmarshal XML data from the specified pull parser and return the resulting content tree.JAXBElementunmarshal(javax.xml.stream.XMLEventReader eventReader, java.lang.Class javaClass)Unmarshal root element to JAXB mappeddeclaredTypeand return the resulting content tree.JAXBElementunmarshal(javax.xml.stream.XMLEventReader eventReader, java.lang.reflect.Type type)JAXBElementunmarshal(javax.xml.stream.XMLEventReader eventReader, TypeMappingInfo type)Unmarshal the object based on the binding metadata associated with the TypeMappingInfo.java.lang.Objectunmarshal(javax.xml.stream.XMLStreamReader streamReader)Unmarshal XML data from the specified pull parser and return the resulting content tree.JAXBElementunmarshal(javax.xml.stream.XMLStreamReader streamReader, java.lang.Class javaClass)Unmarshal root element to JAXB mappeddeclaredTypeand return the resulting content tree.JAXBElementunmarshal(javax.xml.stream.XMLStreamReader streamReader, java.lang.reflect.Type type)JAXBElementunmarshal(javax.xml.stream.XMLStreamReader streamReader, TypeMappingInfo type)Unmarshal the object based on the binding metadata associated with the TypeMappingInfo.java.lang.Objectunmarshal(javax.xml.transform.Source source)Unmarshal XML data from the specified XML Source and return the resulting content tree.JAXBElementunmarshal(javax.xml.transform.Source source, java.lang.Class javaClass)Unmarshal XML data from the specified XML Source bydeclaredTypeand return the resulting content tree.JAXBElementunmarshal(javax.xml.transform.Source source, java.lang.reflect.Type type)JAXBElementunmarshal(javax.xml.transform.Source source, TypeMappingInfo type)Unmarshal the object based on the binding metadata associated with the TypeMappingInfo.java.lang.Objectunmarshal(org.w3c.dom.Node node)Unmarshal global XML data from the specified DOM tree and return the resulting content tree.JAXBElementunmarshal(org.w3c.dom.Node node, java.lang.Class javaClass)Unmarshal XML data by JAXB mappeddeclaredTypeand return the resulting content tree.java.lang.Objectunmarshal(org.xml.sax.InputSource inputSource)Unmarshal XML data from the specified SAX InputSource and return the resulting content tree.
-
-
-
Field Detail
-
XML_JAVATYPE_ADAPTERS
public static final java.lang.String XML_JAVATYPE_ADAPTERS
- See Also:
- Constant Field Values
-
STAX_SOURCE_CLASS_NAME
public static final java.lang.String STAX_SOURCE_CLASS_NAME
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
JAXBUnmarshaller
public JAXBUnmarshaller(XMLUnmarshaller newXMLUnmarshaller, JAXBContext jaxbContext)
-
-
Method Detail
-
getXMLUnmarshaller
public XMLUnmarshaller getXMLUnmarshaller()
-
unmarshal
public java.lang.Object unmarshal(java.io.File file) throws JAXBExceptionDescription copied from interface:UnmarshallerUnmarshal XML data from the specified file and return the resulting content tree.Implements Unmarshal Global Root Element.
- Specified by:
unmarshalin interfaceUnmarshaller- Parameters:
file- the file to unmarshal XML data from- Returns:
- the newly created root object of the java content tree
- Throws:
JAXBException- If any unexpected errors occur while unmarshallingUnmarshalException- If theValidationEventHandlerreturns false from itshandleEventmethod or theUnmarshalleris unable to perform the XML to Java binding. See Unmarshalling XML Data
-
unmarshal
public java.lang.Object unmarshal(java.io.InputStream inputStream) throws JAXBExceptionDescription copied from interface:UnmarshallerUnmarshal XML data from the specified InputStream and return the resulting content tree. Validation event location information may be incomplete when using this form of the unmarshal API.Implements Unmarshal Global Root Element.
- Specified by:
unmarshalin interfaceUnmarshaller- Parameters:
inputStream- the InputStream to unmarshal XML data from- Returns:
- the newly created root object of the java content tree
- Throws:
JAXBException- If any unexpected errors occur while unmarshallingUnmarshalException- If theValidationEventHandlerreturns false from itshandleEventmethod or theUnmarshalleris unable to perform the XML to Java binding. See Unmarshalling XML Data
-
unmarshal
public java.lang.Object unmarshal(java.net.URL url) throws JAXBExceptionDescription copied from interface:UnmarshallerUnmarshal XML data from the specified URL and return the resulting content tree.Implements Unmarshal Global Root Element.
- Specified by:
unmarshalin interfaceUnmarshaller- Parameters:
url- the url to unmarshal XML data from- Returns:
- the newly created root object of the java content tree
- Throws:
JAXBException- If any unexpected errors occur while unmarshallingUnmarshalException- If theValidationEventHandlerreturns false from itshandleEventmethod or theUnmarshalleris unable to perform the XML to Java binding. See Unmarshalling XML Data
-
unmarshal
public java.lang.Object unmarshal(org.xml.sax.InputSource inputSource) throws JAXBExceptionDescription copied from interface:UnmarshallerUnmarshal XML data from the specified SAX InputSource and return the resulting content tree.Implements Unmarshal Global Root Element.
- Specified by:
unmarshalin interfaceUnmarshaller- Parameters:
inputSource- the input source to unmarshal XML data from- Returns:
- the newly created root object of the java content tree
- Throws:
JAXBException- If any unexpected errors occur while unmarshallingUnmarshalException- If theValidationEventHandlerreturns false from itshandleEventmethod or theUnmarshalleris unable to perform the XML to Java binding. See Unmarshalling XML Data
-
unmarshal
public java.lang.Object unmarshal(java.io.Reader reader) throws JAXBExceptionDescription copied from interface:UnmarshallerUnmarshal XML data from the specified Reader and return the resulting content tree. Validation event location information may be incomplete when using this form of the unmarshal API, because a Reader does not provide the system ID.Implements Unmarshal Global Root Element.
- Specified by:
unmarshalin interfaceUnmarshaller- Parameters:
reader- the Reader to unmarshal XML data from- Returns:
- the newly created root object of the java content tree
- Throws:
JAXBException- If any unexpected errors occur while unmarshallingUnmarshalException- If theValidationEventHandlerreturns false from itshandleEventmethod or theUnmarshalleris unable to perform the XML to Java binding. See Unmarshalling XML Data
-
unmarshal
public java.lang.Object unmarshal(org.w3c.dom.Node node) throws JAXBExceptionDescription copied from interface:UnmarshallerUnmarshal global XML data from the specified DOM tree and return the resulting content tree.Implements Unmarshal Global Root Element.
- Specified by:
unmarshalin interfaceUnmarshaller- Parameters:
node- the document/element to unmarshal XML data from. The caller must support at least Document and Element.- Returns:
- the newly created root object of the java content tree
- Throws:
JAXBException- If any unexpected errors occur while unmarshallingUnmarshalException- If theValidationEventHandlerreturns false from itshandleEventmethod or theUnmarshalleris unable to perform the XML to Java binding. See Unmarshalling XML Data- See Also:
Unmarshaller.unmarshal(org.w3c.dom.Node, Class)
-
unmarshal
public JAXBElement unmarshal(org.w3c.dom.Node node, java.lang.Class javaClass) throws JAXBException
Description copied from interface:UnmarshallerUnmarshal XML data by JAXB mappeddeclaredTypeand return the resulting content tree.Implements Unmarshal by Declared Type
- Specified by:
unmarshalin interfaceUnmarshaller- Parameters:
node- the document/element to unmarshal XML data from. The caller must support at least Document and Element.javaClass- appropriate JAXB mapped class to holdnode's XML data.- Returns:
- JAXB Element representation of
node - Throws:
JAXBException- If any unexpected errors occur while unmarshallingUnmarshalException- If theValidationEventHandlerreturns false from itshandleEventmethod or theUnmarshalleris unable to perform the XML to Java binding. See Unmarshalling XML Data
-
unmarshal
public java.lang.Object unmarshal(javax.xml.transform.Source source) throws JAXBExceptionDescription copied from interface:UnmarshallerUnmarshal XML data from the specified XML Source and return the resulting content tree.Implements Unmarshal Global Root Element.
A client application can choose not to use the default parser mechanism supplied with their JAXB provider. Any SAX 2.0 compliant parser can be substituted for the JAXB provider's default mechanism. To do so, the client application must properly configure a
SAXSourcecontaining anXMLReaderimplemented by the SAX 2.0 parser provider. If theXMLReaderhas anorg.xml.sax.ErrorHandlerregistered on it, it will be replaced by the JAXB Provider so that validation errors can be reported via theValidationEventHandlermechanism of JAXB. If theSAXSourcedoes not contain anXMLReader, then the JAXB provider's default parser mechanism will be used.This parser replacement mechanism can also be used to replace the JAXB provider's unmarshal-time validation engine. The client application must properly configure their SAX 2.0 compliant parser to perform validation (as shown in the example above). Any
SAXParserExceptionsencountered by the parser during the unmarshal operation will be processed by the JAXB provider and converted into JAXBValidationEventobjects which will be reported back to the client via theValidationEventHandlerregistered with theUnmarshaller. Note: specifying a substitute validating SAX 2.0 parser for unmarshalling does not necessarily replace the validation engine used by the JAXB provider for performing on-demand validation.The only way for a client application to specify an alternate parser mechanism to be used during unmarshal is via the
unmarshal(SAXSource)API. All other forms of the unmarshal method (File, URL, Node, etc) will use the JAXB provider's default parser and validator mechanisms.- Specified by:
unmarshalin interfaceUnmarshaller- Parameters:
source- the XML Source to unmarshal XML data from (providers are only required to support SAXSource, DOMSource, and StreamSource)- Returns:
- the newly created root object of the java content tree
- Throws:
JAXBException- If any unexpected errors occur while unmarshallingUnmarshalException- If theValidationEventHandlerreturns false from itshandleEventmethod or theUnmarshalleris unable to perform the XML to Java binding. See Unmarshalling XML Data- See Also:
Unmarshaller.unmarshal(javax.xml.transform.Source, Class)
-
unmarshal
public JAXBElement unmarshal(javax.xml.transform.Source source, java.lang.Class javaClass) throws JAXBException
Description copied from interface:UnmarshallerUnmarshal XML data from the specified XML Source bydeclaredTypeand return the resulting content tree.Implements Unmarshal by Declared Type
- Specified by:
unmarshalin interfaceUnmarshaller- Parameters:
source- the XML Source to unmarshal XML data from (providers are only required to support SAXSource, DOMSource, and StreamSource)javaClass- appropriate JAXB mapped class to holdsource's xml root element- Returns:
- Java content rooted by JAXB Element
- Throws:
JAXBException- If any unexpected errors occur while unmarshallingUnmarshalException- If theValidationEventHandlerreturns false from itshandleEventmethod or theUnmarshalleris unable to perform the XML to Java binding. See Unmarshalling XML Data
-
unmarshal
public JAXBElement unmarshal(javax.xml.transform.Source source, java.lang.reflect.Type type) throws JAXBException
- Throws:
JAXBException
-
unmarshal
public JAXBElement unmarshal(javax.xml.transform.Source source, TypeMappingInfo type) throws JAXBException
Unmarshal the object based on the binding metadata associated with the TypeMappingInfo.- Throws:
JAXBException
-
unmarshal
public JAXBElement unmarshal(javax.xml.stream.XMLStreamReader streamReader, java.lang.Class javaClass) throws JAXBException
Description copied from interface:UnmarshallerUnmarshal root element to JAXB mappeddeclaredTypeand return the resulting content tree.This method implements unmarshal by declaredType.
This method assumes that the parser is on a START_DOCUMENT or START_ELEMENT event. Unmarshalling will be done from this start event to the corresponding end event. If this method returns successfully, the
readerwill be pointing at the token right after the end event.- Specified by:
unmarshalin interfaceUnmarshaller- Parameters:
streamReader- The parser to be read.javaClass- appropriate JAXB mapped class to holdreader's START_ELEMENT XML data.- Returns:
- content tree rooted by JAXB Element representation
- Throws:
JAXBException- If any unexpected errors occur while unmarshallingUnmarshalException- If theValidationEventHandlerreturns false from itshandleEventmethod or theUnmarshalleris unable to perform the XML to Java binding. See Unmarshalling XML Data
-
unmarshal
public JAXBElement unmarshal(javax.xml.stream.XMLStreamReader streamReader, java.lang.reflect.Type type) throws JAXBException
- Throws:
JAXBException
-
unmarshal
public JAXBElement unmarshal(javax.xml.stream.XMLStreamReader streamReader, TypeMappingInfo type) throws JAXBException
Unmarshal the object based on the binding metadata associated with the TypeMappingInfo.- Throws:
JAXBException
-
unmarshal
public java.lang.Object unmarshal(javax.xml.stream.XMLStreamReader streamReader) throws JAXBExceptionDescription copied from interface:UnmarshallerUnmarshal XML data from the specified pull parser and return the resulting content tree.Implements Unmarshal Global Root Element.
This method assumes that the parser is on a START_DOCUMENT or START_ELEMENT event. Unmarshalling will be done from this start event to the corresponding end event. If this method returns successfully, the
readerwill be pointing at the token right after the end event.- Specified by:
unmarshalin interfaceUnmarshaller- Parameters:
streamReader- The parser to be read.- Returns:
- the newly created root object of the java content tree.
- Throws:
JAXBException- If any unexpected errors occur while unmarshallingUnmarshalException- If theValidationEventHandlerreturns false from itshandleEventmethod or theUnmarshalleris unable to perform the XML to Java binding. See Unmarshalling XML Data- See Also:
Unmarshaller.unmarshal(javax.xml.stream.XMLStreamReader, Class)
-
unmarshal
public JAXBElement unmarshal(javax.xml.stream.XMLEventReader eventReader, java.lang.Class javaClass) throws JAXBException
Description copied from interface:UnmarshallerUnmarshal root element to JAXB mappeddeclaredTypeand return the resulting content tree.This method implements unmarshal by declaredType.
This method assumes that the parser is on a START_DOCUMENT or START_ELEMENT event. Unmarshalling will be done from this start event to the corresponding end event. If this method returns successfully, the
readerwill be pointing at the token right after the end event.- Specified by:
unmarshalin interfaceUnmarshaller- Parameters:
eventReader- The parser to be read.javaClass- appropriate JAXB mapped class to holdreader's START_ELEMENT XML data.- Returns:
- content tree rooted by JAXB Element representation
- Throws:
JAXBException- If any unexpected errors occur while unmarshallingUnmarshalException- If theValidationEventHandlerreturns false from itshandleEventmethod or theUnmarshalleris unable to perform the XML to Java binding. See Unmarshalling XML Data
-
unmarshal
public JAXBElement unmarshal(javax.xml.stream.XMLEventReader eventReader, java.lang.reflect.Type type) throws JAXBException
- Throws:
JAXBException
-
unmarshal
public JAXBElement unmarshal(javax.xml.stream.XMLEventReader eventReader, TypeMappingInfo type) throws JAXBException
Unmarshal the object based on the binding metadata associated with the TypeMappingInfo.- Throws:
JAXBException
-
unmarshal
public java.lang.Object unmarshal(javax.xml.stream.XMLEventReader eventReader) throws JAXBExceptionDescription copied from interface:UnmarshallerUnmarshal XML data from the specified pull parser and return the resulting content tree.This method is an Unmarshal Global Root method.
This method assumes that the parser is on a START_DOCUMENT or START_ELEMENT event. Unmarshalling will be done from this start event to the corresponding end event. If this method returns successfully, the
readerwill be pointing at the token right after the end event.- Specified by:
unmarshalin interfaceUnmarshaller- Parameters:
eventReader- The parser to be read.- Returns:
- the newly created root object of the java content tree.
- Throws:
JAXBException- If any unexpected errors occur while unmarshallingUnmarshalException- If theValidationEventHandlerreturns false from itshandleEventmethod or theUnmarshalleris unable to perform the XML to Java binding. See Unmarshalling XML Data- See Also:
Unmarshaller.unmarshal(javax.xml.stream.XMLEventReader, Class)
-
getUnmarshallerHandler
public UnmarshallerHandler getUnmarshallerHandler()
Description copied from interface:UnmarshallerGet an unmarshaller handler object that can be used as a component in an XML pipeline.The JAXB Provider can return the same handler object for multiple invocations of this method. In other words, this method does not necessarily create a new instance of
UnmarshallerHandler. If the application needs to use more than oneUnmarshallerHandler, it should create more than oneUnmarshaller.- Specified by:
getUnmarshallerHandlerin interfaceUnmarshaller- Returns:
- the unmarshaller handler object
- See Also:
UnmarshallerHandler
-
setValidating
public void setValidating(boolean validate) throws JAXBExceptionDescription copied from interface:UnmarshallerSpecifies whether or not the default validation mechanism of theUnmarshallershould validate during unmarshal operations. By default, theUnmarshallerdoes not validate.This method may only be invoked before or after calling one of the unmarshal methods.
This method only controls the JAXB Provider's default unmarshal-time validation mechanism - it has no impact on clients that specify their own validating SAX 2.0 compliant parser. Clients that specify their own unmarshal-time validation mechanism may wish to turn off the JAXB Provider's default validation mechanism via this API to avoid "double validation".
This method is deprecated as of JAXB 2.0 - please use the new
Unmarshaller.setSchema(javax.xml.validation.Schema)API.- Specified by:
setValidatingin interfaceUnmarshaller- Parameters:
validate- true if the Unmarshaller should validate during unmarshal, false otherwise- Throws:
JAXBException- if an error occurred while enabling or disabling validation at unmarshal time
-
isValidating
public boolean isValidating() throws JAXBExceptionDescription copied from interface:UnmarshallerIndicates whether or not theUnmarshalleris configured to validate during unmarshal operations.This API returns the state of the JAXB Provider's default unmarshal-time validation mechanism.
This method is deprecated as of JAXB 2.0 - please use the new
Unmarshaller.getSchema()API.- Specified by:
isValidatingin interfaceUnmarshaller- Returns:
- true if the Unmarshaller is configured to validate during unmarshal operations, false otherwise
- Throws:
JAXBException- if an error occurs while retrieving the validating flag
-
setEventHandler
public void setEventHandler(ValidationEventHandler newValidationEventHandler) throws JAXBException
Description copied from interface:UnmarshallerAllow an application to register aValidationEventHandler.The
ValidationEventHandlerwill be called by the JAXB Provider if any validation errors are encountered during calls to any of the unmarshal methods. If the client application does not register aValidationEventHandlerbefore invoking the unmarshal methods, thenValidationEventswill be handled by the default event handler which will terminate the unmarshal operation after the first error or fatal error is encountered.Calling this method with a null parameter will cause the Unmarshaller to revert back to the default event handler.
- Specified by:
setEventHandlerin interfaceUnmarshaller- Parameters:
newValidationEventHandler- the validation event handler- Throws:
JAXBException- if an error was encountered while setting the event handler
-
getEventHandler
public ValidationEventHandler getEventHandler() throws JAXBException
Description copied from interface:UnmarshallerReturn the current event handler or the default event handler if one hasn't been set.- Specified by:
getEventHandlerin interfaceUnmarshaller- Returns:
- the current ValidationEventHandler or the default event handler if it hasn't been set
- Throws:
JAXBException- if an error was encountered while getting the current event handler
-
setProperty
public void setProperty(java.lang.String key, java.lang.Object value) throws PropertyExceptionSet a property on the JAXBUnmarshaller. Attempting to set any unsupported property will result in a javax.xml.bind.PropertyException.- Specified by:
setPropertyin interfaceUnmarshaller- Parameters:
key- the name of the property to be set. This value can either be specified using one of the constant fields or a user supplied string.value- the value of the property to be set- Throws:
PropertyException- when there is an error processing the given property or value- See Also:
UnmarshallerProperties
-
getProperty
public java.lang.Object getProperty(java.lang.String key) throws PropertyExceptionGet a property from the JAXBMarshaller. Attempting to get any unsupported property will result in a javax.xml.bind.PropertyException See Supported Properties.- Specified by:
getPropertyin interfaceUnmarshaller- Parameters:
key- the name of the property to retrieve- Returns:
- the value of the requested property
- Throws:
PropertyException- when there is an error retrieving the given property or value property name- See Also:
UnmarshallerProperties
-
getListener
public Unmarshaller.Listener getListener()
Description copied from interface:UnmarshallerReturn
Unmarshaller.Listenerregistered with thisUnmarshaller.- Specified by:
getListenerin interfaceUnmarshaller- Returns:
- registered
Unmarshaller.Listenerornullif no Listener is registered with this Unmarshaller.
-
setListener
public void setListener(Unmarshaller.Listener listener)
Description copied from interface:UnmarshallerRegister unmarshal event callback
Unmarshaller.Listenerwith thisUnmarshaller.There is only one Listener per Unmarshaller. Setting a Listener replaces the previous set Listener. One can unregister current Listener by setting listener to
null.- Specified by:
setListenerin interfaceUnmarshaller- Parameters:
listener- provides unmarshal event callbacks for thisUnmarshaller
-
getAdapter
public XmlAdapter getAdapter(java.lang.Class javaClass)
Description copied from interface:UnmarshallerGets the adapter associated with the specified type. This is the reverse operation of theUnmarshaller.setAdapter(javax.xml.bind.annotation.adapters.XmlAdapter)method.- Specified by:
getAdapterin interfaceUnmarshaller
-
setAdapter
public void setAdapter(java.lang.Class javaClass, XmlAdapter adapter)Description copied from interface:UnmarshallerAssociates a configured instance ofXmlAdapterwith this unmarshaller.Every unmarshaller internally maintains a
Map<Class,XmlAdapter>, which it uses for unmarshalling classes whose fields/methods are annotated withXmlJavaTypeAdapter.This method allows applications to use a configured instance of
XmlAdapter. When an instance of an adapter is not given, an unmarshaller will create one by invoking its default constructor.- Specified by:
setAdapterin interfaceUnmarshaller- Parameters:
javaClass- The type of the adapter. The specified instance will be used whenXmlJavaTypeAdapter.value()refers to this type.adapter- The instance of the adapter to be used. If null, it will un-register the current adapter set for this type.
-
setAdapter
public void setAdapter(XmlAdapter adapter)
Description copied from interface:UnmarshallerAssociates a configured instance ofXmlAdapterwith this unmarshaller.This is a convenience method that invokes
setAdapter(adapter.getClass(),adapter);.- Specified by:
setAdapterin interfaceUnmarshaller- See Also:
Unmarshaller.setAdapter(Class,XmlAdapter)
-
setSchema
public void setSchema(javax.xml.validation.Schema schema)
Description copied from interface:UnmarshallerSpecify the JAXP 1.3Schemaobject that should be used to validate subsequent unmarshal operations against. Passing null into this method will disable validation.This method replaces the deprecated
setValidating(boolean)API.Initially this property is set to
null.- Specified by:
setSchemain interfaceUnmarshaller- Parameters:
schema- Schema object to validate unmarshal operations against or null to disable validation
-
getSchema
public javax.xml.validation.Schema getSchema()
Description copied from interface:UnmarshallerGet the JAXP 1.3Schemaobject being used to perform unmarshal-time validation. If there is no Schema set on the unmarshaller, then this method will return null indicating that unmarshal-time validation will not be performed.This method provides replacement functionality for the deprecated
Unmarshaller.isValidating()API as well as access to the Schema object. To determine if the Unmarshaller has validation enabled, simply test the return type for null:boolean isValidating = u.getSchema()!=null;- Specified by:
getSchemain interfaceUnmarshaller- Returns:
- the Schema object being used to perform unmarshal-time validation or null if not present
-
getAttachmentUnmarshaller
public AttachmentUnmarshaller getAttachmentUnmarshaller()
- Specified by:
getAttachmentUnmarshallerin interfaceUnmarshaller
-
setAttachmentUnmarshaller
public void setAttachmentUnmarshaller(AttachmentUnmarshaller unmarshaller)
Description copied from interface:UnmarshallerAssociate a context that resolves cid's, content-id URIs, to binary data passed as attachments.
Unmarshal time validation, enabled via
Unmarshaller.setSchema(Schema), must be supported even when unmarshaller is performing XOP processing.- Specified by:
setAttachmentUnmarshallerin interfaceUnmarshaller
-
setUnmarshalCallbacks
public void setUnmarshalCallbacks(java.util.Map callbacks)
-
getJaxbContext
public JAXBContext getJaxbContext()
-
getIDResolver
public IDResolver getIDResolver()
Return this Unmarshaller's custom IDResolver.- Returns:
- the custom IDResolver, or null if one has not been specified.
- See Also:
IDResolver- Since:
- 2.3.3
-
setIDResolver
public void setIDResolver(IDResolver idResolver)
Set this Unmarshaller's custom IDResolver.- See Also:
IDResolver- Since:
- 2.3.3
-
getConstraintViolations
public java.util.Set<ConstraintViolationWrapper<java.lang.Object>> getConstraintViolations()
Returns constraint violations stored in the underlyingJAXBBeanValidatorinstance.- Returns:
- set of constraint violations from last unmarshal
-
-