Class UnmarshallerImpl
java.lang.Object
javax.xml.bind.helpers.AbstractUnmarshallerImpl
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Unmarshaller
,ValidationEventHandler
public final class UnmarshallerImpl
extends AbstractUnmarshallerImpl
implements ValidationEventHandler, Closeable
Default Unmarshaller implementation.
This class can be extended by the generated code to provide type-safe unmarshall methods.
- Author:
- Kohsuke KAWAGUCHI
-
Nested Class Summary
Nested classes/interfaces inherited from interface javax.xml.bind.Unmarshaller
Unmarshaller.Listener
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final JAXBContextImpl
OwningJAXBContext
final UnmarshallingContext
static final String
Fields inherited from class javax.xml.bind.helpers.AbstractUnmarshallerImpl
validating
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Must be called from same thread which created the UnmarshallerImpl instance.final XmlVisitor
createUnmarshallerHandler
(InfosetScanner scanner, boolean inplace, JaxBeanInfo expectedType) Creates and configures a new unmarshalling pipe line.protected void
finalize()
<A extends XmlAdapter>
AgetAdapter
(Class<A> type) <T> JaxBeanInfo
<T> getBeanInfo
(Class<T> clazz) final ValidationEventHandler
getProperty
(String name) protected XMLReader
Obtains a configured XMLReader.boolean
handleEvent
(ValidationEvent event) Default error handling behavior forUnmarshaller
.final boolean
Returns true if an event handler is installed.boolean
Deprecated.since 2.0static boolean
needsInterning
(XMLReader reader) <A extends XmlAdapter>
voidsetAdapter
(Class<A> type, A adapter) void
void
setListener
(Unmarshaller.Listener listener) void
setProperty
(String name, Object value) void
void
setValidating
(boolean validating) Deprecated.since 2.0unmarshal
(XMLEventReader reader) <T> JAXBElement
<T> unmarshal
(XMLEventReader reader, Class<T> expectedType) unmarshal
(XMLStreamReader reader) <T> JAXBElement
<T> unmarshal
(XMLStreamReader reader, Class<T> expectedType) final Object
Deprecated.<T> JAXBElement
<T> final Object
<T> JAXBElement
<T> protected Object
unmarshal
(XMLReader reader, InputSource source) protected <T> JAXBElement
<T> unmarshal
(XMLReader reader, InputSource source, Class<T> expectedType) unmarshal0
(InputStream input, JaxBeanInfo expectedType) unmarshal0
(XMLStreamReader reader, JaxBeanInfo expectedType) unmarshal0
(Source source, JaxBeanInfo expectedType) final Object
unmarshal0
(Node node, JaxBeanInfo expectedType) Methods inherited from class javax.xml.bind.helpers.AbstractUnmarshallerImpl
setAdapter, setEventHandler, unmarshal, unmarshal, unmarshal, unmarshal, unmarshal, unmarshal
-
Field Details
-
context
OwningJAXBContext
-
coordinator
-
FACTORY
- See Also:
-
-
Constructor Details
-
UnmarshallerImpl
-
-
Method Details
-
getUnmarshallerHandler
- Specified by:
getUnmarshallerHandler
in interfaceUnmarshaller
-
getXMLReader
Obtains a configured XMLReader. This method is used when the client-specifiedSAXSource
object doesn't have XMLReader.Unmarshaller
is not re-entrant, so we will only use one instance of XMLReader. Overriden in order to fix potential security issue.- Overrides:
getXMLReader
in classAbstractUnmarshallerImpl
- Throws:
JAXBException
-
createUnmarshallerHandler
public final XmlVisitor createUnmarshallerHandler(InfosetScanner scanner, boolean inplace, JaxBeanInfo expectedType) Creates and configures a new unmarshalling pipe line. Depending on the setting, we put a validator as a filter.- Returns:
- A component that implements both
UnmarshallerHandler
andValidationEventHandler
. All the parsing errors should be reported to this error handler for the unmarshalling process to work correctly. Also, returned handler expects all the XML names to be interned.
-
needsInterning
-
unmarshal
- Specified by:
unmarshal
in classAbstractUnmarshallerImpl
- Throws:
JAXBException
-
unmarshal
protected <T> JAXBElement<T> unmarshal(XMLReader reader, InputSource source, Class<T> expectedType) throws JAXBException - Throws:
JAXBException
-
unmarshal
- Specified by:
unmarshal
in interfaceUnmarshaller
- Overrides:
unmarshal
in classAbstractUnmarshallerImpl
- Throws:
JAXBException
-
unmarshal0
- Throws:
JAXBException
-
getEventHandler
- Specified by:
getEventHandler
in interfaceUnmarshaller
- Overrides:
getEventHandler
in classAbstractUnmarshallerImpl
-
hasEventHandler
public final boolean hasEventHandler()Returns true if an event handler is installed.The default handler ignores any errors, and for that this method returns false.
-
unmarshal
- Specified by:
unmarshal
in interfaceUnmarshaller
- Overrides:
unmarshal
in classAbstractUnmarshallerImpl
- Throws:
JAXBException
-
unmarshal
- Specified by:
unmarshal
in interfaceUnmarshaller
- Throws:
JAXBException
-
unmarshal
Deprecated.- Throws:
JAXBException
-
unmarshal0
- Throws:
JAXBException
-
unmarshal
- Specified by:
unmarshal
in interfaceUnmarshaller
- Overrides:
unmarshal
in classAbstractUnmarshallerImpl
- Throws:
JAXBException
-
unmarshal
public <T> JAXBElement<T> unmarshal(XMLStreamReader reader, Class<T> expectedType) throws JAXBException - Specified by:
unmarshal
in interfaceUnmarshaller
- Overrides:
unmarshal
in classAbstractUnmarshallerImpl
- Throws:
JAXBException
-
unmarshal0
- Throws:
JAXBException
-
unmarshal
public <T> JAXBElement<T> unmarshal(XMLEventReader reader, Class<T> expectedType) throws JAXBException - Specified by:
unmarshal
in interfaceUnmarshaller
- Overrides:
unmarshal
in classAbstractUnmarshallerImpl
- Throws:
JAXBException
-
unmarshal
- Specified by:
unmarshal
in interfaceUnmarshaller
- Overrides:
unmarshal
in classAbstractUnmarshallerImpl
- Throws:
JAXBException
-
unmarshal0
- Throws:
JAXBException
-
getProperty
- Specified by:
getProperty
in interfaceUnmarshaller
- Overrides:
getProperty
in classAbstractUnmarshallerImpl
- Throws:
PropertyException
-
setProperty
- Specified by:
setProperty
in interfaceUnmarshaller
- Overrides:
setProperty
in classAbstractUnmarshallerImpl
- Throws:
PropertyException
-
setSchema
- Specified by:
setSchema
in interfaceUnmarshaller
- Overrides:
setSchema
in classAbstractUnmarshallerImpl
-
getSchema
- Specified by:
getSchema
in interfaceUnmarshaller
- Overrides:
getSchema
in classAbstractUnmarshallerImpl
-
getAttachmentUnmarshaller
- Specified by:
getAttachmentUnmarshaller
in interfaceUnmarshaller
- Overrides:
getAttachmentUnmarshaller
in classAbstractUnmarshallerImpl
-
setAttachmentUnmarshaller
- Specified by:
setAttachmentUnmarshaller
in interfaceUnmarshaller
- Overrides:
setAttachmentUnmarshaller
in classAbstractUnmarshallerImpl
-
isValidating
public boolean isValidating()Deprecated.since 2.0- Specified by:
isValidating
in interfaceUnmarshaller
- Overrides:
isValidating
in classAbstractUnmarshallerImpl
-
setValidating
public void setValidating(boolean validating) Deprecated.since 2.0- Specified by:
setValidating
in interfaceUnmarshaller
- Overrides:
setValidating
in classAbstractUnmarshallerImpl
-
setAdapter
- Specified by:
setAdapter
in interfaceUnmarshaller
- Overrides:
setAdapter
in classAbstractUnmarshallerImpl
-
getAdapter
- Specified by:
getAdapter
in interfaceUnmarshaller
- Overrides:
getAdapter
in classAbstractUnmarshallerImpl
-
createUnmarshalException
- Overrides:
createUnmarshalException
in classAbstractUnmarshallerImpl
-
handleEvent
Default error handling behavior forUnmarshaller
.- Specified by:
handleEvent
in interfaceValidationEventHandler
-
getBeanInfo
- Throws:
JAXBException
-
getListener
- Specified by:
getListener
in interfaceUnmarshaller
- Overrides:
getListener
in classAbstractUnmarshallerImpl
-
setListener
- Specified by:
setListener
in interfaceUnmarshaller
- Overrides:
setListener
in classAbstractUnmarshallerImpl
-
getContext
-
finalize
-
close
Must be called from same thread which created the UnmarshallerImpl instance.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-