Class UnmarshallerImpl
java.lang.Object
jakarta.xml.bind.helpers.AbstractUnmarshallerImpl
org.glassfish.jaxb.runtime.v2.runtime.unmarshaller.UnmarshallerImpl
- All Implemented Interfaces:
Unmarshaller,ValidationEventHandler,Closeable,AutoCloseable
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 jakarta.xml.bind.Unmarshaller
Unmarshaller.Listener -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final JAXBContextImplOwningJAXBContextfinal UnmarshallingContextstatic final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Must be called from same thread which created the UnmarshallerImpl instance.createUnmarshallerHandler(InfosetScanner scanner, boolean inplace, JaxBeanInfo expectedType) Creates and configures a new unmarshalling pipe line.protected voidfinalize()<A extends XmlAdapter<?,?>>
AgetAdapter(Class<A> type) <T> JaxBeanInfo<T> getBeanInfo(Class<T> clazz) getProperty(String name) protected XMLReaderObtains a configured XMLReader.booleanhandleEvent(ValidationEvent event) Default error handling behavior forUnmarshaller.booleanReturns true if an event handler is installed.booleanDeprecated.since 2.0static booleanneedsInterning(XMLReader reader) <A extends XmlAdapter<?,?>>
voidsetAdapter(Class<A> type, A adapter) voidvoidsetListener(Unmarshaller.Listener listener) voidsetProperty(String name, Object value) voidvoidsetValidating(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) Deprecated.<T> JAXBElement<T> <T> JAXBElement<T> protected Objectunmarshal(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) unmarshal0(Node node, JaxBeanInfo expectedType) Methods inherited from class jakarta.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:
getUnmarshallerHandlerin interfaceUnmarshaller
-
getXMLReader
Obtains a configured XMLReader. This method is used when the client-specifiedSAXSourceobject doesn't have XMLReader.Unmarshalleris not re-entrant, so we will only use one instance of XMLReader. Overriden in order to fix potential security issue.- Overrides:
getXMLReaderin classAbstractUnmarshallerImpl- Throws:
JAXBException
-
createUnmarshallerHandler
public 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
UnmarshallerHandlerandValidationEventHandler. 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:
unmarshalin classAbstractUnmarshallerImpl- Throws:
JAXBException
-
unmarshal
protected <T> JAXBElement<T> unmarshal(XMLReader reader, InputSource source, Class<T> expectedType) throws JAXBException - Throws:
JAXBException
-
unmarshal
- Specified by:
unmarshalin interfaceUnmarshaller- Overrides:
unmarshalin classAbstractUnmarshallerImpl- Throws:
JAXBException
-
unmarshal0
- Throws:
JAXBException
-
getEventHandler
- Specified by:
getEventHandlerin interfaceUnmarshaller- Overrides:
getEventHandlerin classAbstractUnmarshallerImpl
-
hasEventHandler
public 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:
unmarshalin interfaceUnmarshaller- Overrides:
unmarshalin classAbstractUnmarshallerImpl- Throws:
JAXBException
-
unmarshal
- Specified by:
unmarshalin interfaceUnmarshaller- Throws:
JAXBException
-
unmarshal
Deprecated.- Throws:
JAXBException
-
unmarshal0
- Throws:
JAXBException
-
unmarshal
- Specified by:
unmarshalin interfaceUnmarshaller- Overrides:
unmarshalin classAbstractUnmarshallerImpl- Throws:
JAXBException
-
unmarshal
public <T> JAXBElement<T> unmarshal(XMLStreamReader reader, Class<T> expectedType) throws JAXBException - Specified by:
unmarshalin interfaceUnmarshaller- Overrides:
unmarshalin classAbstractUnmarshallerImpl- Throws:
JAXBException
-
unmarshal0
- Throws:
JAXBException
-
unmarshal
public <T> JAXBElement<T> unmarshal(XMLEventReader reader, Class<T> expectedType) throws JAXBException - Specified by:
unmarshalin interfaceUnmarshaller- Overrides:
unmarshalin classAbstractUnmarshallerImpl- Throws:
JAXBException
-
unmarshal
- Specified by:
unmarshalin interfaceUnmarshaller- Overrides:
unmarshalin classAbstractUnmarshallerImpl- Throws:
JAXBException
-
unmarshal0
- Throws:
JAXBException
-
getProperty
- Specified by:
getPropertyin interfaceUnmarshaller- Overrides:
getPropertyin classAbstractUnmarshallerImpl- Throws:
PropertyException
-
setProperty
- Specified by:
setPropertyin interfaceUnmarshaller- Overrides:
setPropertyin classAbstractUnmarshallerImpl- Throws:
PropertyException
-
setSchema
- Specified by:
setSchemain interfaceUnmarshaller- Overrides:
setSchemain classAbstractUnmarshallerImpl
-
getSchema
- Specified by:
getSchemain interfaceUnmarshaller- Overrides:
getSchemain classAbstractUnmarshallerImpl
-
getAttachmentUnmarshaller
- Specified by:
getAttachmentUnmarshallerin interfaceUnmarshaller- Overrides:
getAttachmentUnmarshallerin classAbstractUnmarshallerImpl
-
setAttachmentUnmarshaller
- Specified by:
setAttachmentUnmarshallerin interfaceUnmarshaller- Overrides:
setAttachmentUnmarshallerin classAbstractUnmarshallerImpl
-
isValidating
Deprecated.since 2.0 -
setValidating
Deprecated.since 2.0 -
setAdapter
- Specified by:
setAdapterin interfaceUnmarshaller- Overrides:
setAdapterin classAbstractUnmarshallerImpl
-
getAdapter
- Specified by:
getAdapterin interfaceUnmarshaller- Overrides:
getAdapterin classAbstractUnmarshallerImpl
-
createUnmarshalException
- Overrides:
createUnmarshalExceptionin classAbstractUnmarshallerImpl
-
handleEvent
Default error handling behavior forUnmarshaller.- Specified by:
handleEventin interfaceValidationEventHandler
-
getBeanInfo
- Throws:
JAXBException
-
getListener
- Specified by:
getListenerin interfaceUnmarshaller- Overrides:
getListenerin classAbstractUnmarshallerImpl
-
setListener
- Specified by:
setListenerin interfaceUnmarshaller- Overrides:
setListenerin classAbstractUnmarshallerImpl
-
getContext
-
finalize
-
close
Must be called from same thread which created the UnmarshallerImpl instance.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-