- 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
Fields Modifier and Type Field Description protected JAXBContextImplcontextOwningJAXBContextUnmarshallingContextcoordinatorstatic StringFACTORY-
Fields inherited from class javax.xml.bind.helpers.AbstractUnmarshallerImpl
validating
-
-
Constructor Summary
Constructors Constructor Description UnmarshallerImpl(JAXBContextImpl context, AssociationMap assoc)
-
Method Summary
-
Methods inherited from class javax.xml.bind.helpers.AbstractUnmarshallerImpl
setAdapter, setEventHandler, unmarshal, unmarshal, unmarshal, unmarshal, unmarshal, unmarshal
-
-
-
-
Field Detail
-
context
protected final JAXBContextImpl context
OwningJAXBContext
-
coordinator
public final UnmarshallingContext coordinator
-
FACTORY
public static final String FACTORY
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
UnmarshallerImpl
public UnmarshallerImpl(JAXBContextImpl context, AssociationMap assoc)
-
-
Method Detail
-
getUnmarshallerHandler
public UnmarshallerHandler getUnmarshallerHandler()
- Specified by:
getUnmarshallerHandlerin interfaceUnmarshaller
-
getXMLReader
protected XMLReader getXMLReader() throws JAXBException
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 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
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
public static boolean needsInterning(XMLReader reader)
-
unmarshal
protected Object unmarshal(XMLReader reader, InputSource source) throws JAXBException
- Specified by:
unmarshalin classAbstractUnmarshallerImpl- Throws:
JAXBException
-
unmarshal
protected <T> JAXBElement<T> unmarshal(XMLReader reader, InputSource source, Class<T> expectedType) throws JAXBException
- Throws:
JAXBException
-
unmarshal
public <T> JAXBElement<T> unmarshal(Source source, Class<T> expectedType) throws JAXBException
- Specified by:
unmarshalin interfaceUnmarshaller- Overrides:
unmarshalin classAbstractUnmarshallerImpl- Throws:
JAXBException
-
unmarshal0
public Object unmarshal0(Source source, JaxBeanInfo expectedType) throws JAXBException
- Throws:
JAXBException
-
getEventHandler
public final ValidationEventHandler getEventHandler()
- Specified by:
getEventHandlerin interfaceUnmarshaller- Overrides:
getEventHandlerin 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
public <T> JAXBElement<T> unmarshal(Node node, Class<T> expectedType) throws JAXBException
- Specified by:
unmarshalin interfaceUnmarshaller- Overrides:
unmarshalin classAbstractUnmarshallerImpl- Throws:
JAXBException
-
unmarshal
public final Object unmarshal(Node node) throws JAXBException
- Specified by:
unmarshalin interfaceUnmarshaller- Throws:
JAXBException
-
unmarshal
@Deprecated public final Object unmarshal(SAXSource source) throws JAXBException
Deprecated.- Throws:
JAXBException
-
unmarshal0
public final Object unmarshal0(Node node, JaxBeanInfo expectedType) throws JAXBException
- Throws:
JAXBException
-
unmarshal
public Object unmarshal(XMLStreamReader reader) throws JAXBException
- 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
public Object unmarshal0(XMLStreamReader reader, JaxBeanInfo expectedType) throws JAXBException
- 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
public Object unmarshal(XMLEventReader reader) throws JAXBException
- Specified by:
unmarshalin interfaceUnmarshaller- Overrides:
unmarshalin classAbstractUnmarshallerImpl- Throws:
JAXBException
-
unmarshal0
public Object unmarshal0(InputStream input, JaxBeanInfo expectedType) throws JAXBException
- Throws:
JAXBException
-
getProperty
public Object getProperty(String name) throws PropertyException
- Specified by:
getPropertyin interfaceUnmarshaller- Overrides:
getPropertyin classAbstractUnmarshallerImpl- Throws:
PropertyException
-
setProperty
public void setProperty(String name, Object value) throws PropertyException
- Specified by:
setPropertyin interfaceUnmarshaller- Overrides:
setPropertyin classAbstractUnmarshallerImpl- Throws:
PropertyException
-
setSchema
public void setSchema(Schema schema)
- Specified by:
setSchemain interfaceUnmarshaller- Overrides:
setSchemain classAbstractUnmarshallerImpl
-
getSchema
public Schema getSchema()
- Specified by:
getSchemain interfaceUnmarshaller- Overrides:
getSchemain classAbstractUnmarshallerImpl
-
getAttachmentUnmarshaller
public AttachmentUnmarshaller getAttachmentUnmarshaller()
- Specified by:
getAttachmentUnmarshallerin interfaceUnmarshaller- Overrides:
getAttachmentUnmarshallerin classAbstractUnmarshallerImpl
-
setAttachmentUnmarshaller
public void setAttachmentUnmarshaller(AttachmentUnmarshaller au)
- Specified by:
setAttachmentUnmarshallerin interfaceUnmarshaller- Overrides:
setAttachmentUnmarshallerin classAbstractUnmarshallerImpl
-
isValidating
public boolean isValidating()
Deprecated.since 2.0- Specified by:
isValidatingin interfaceUnmarshaller- Overrides:
isValidatingin classAbstractUnmarshallerImpl
-
setValidating
public void setValidating(boolean validating)
Deprecated.since 2.0- Specified by:
setValidatingin interfaceUnmarshaller- Overrides:
setValidatingin classAbstractUnmarshallerImpl
-
setAdapter
public <A extends XmlAdapter> void setAdapter(Class<A> type, A adapter)
- Specified by:
setAdapterin interfaceUnmarshaller- Overrides:
setAdapterin classAbstractUnmarshallerImpl
-
getAdapter
public <A extends XmlAdapter> A getAdapter(Class<A> type)
- Specified by:
getAdapterin interfaceUnmarshaller- Overrides:
getAdapterin classAbstractUnmarshallerImpl
-
createUnmarshalException
public UnmarshalException createUnmarshalException(SAXException e)
- Overrides:
createUnmarshalExceptionin classAbstractUnmarshallerImpl
-
handleEvent
public boolean handleEvent(ValidationEvent event)
Default error handling behavior forUnmarshaller.- Specified by:
handleEventin interfaceValidationEventHandler
-
getBeanInfo
public <T> JaxBeanInfo<T> getBeanInfo(Class<T> clazz) throws JAXBException
- Throws:
JAXBException
-
getListener
public Unmarshaller.Listener getListener()
- Specified by:
getListenerin interfaceUnmarshaller- Overrides:
getListenerin classAbstractUnmarshallerImpl
-
setListener
public void setListener(Unmarshaller.Listener listener)
- Specified by:
setListenerin interfaceUnmarshaller- Overrides:
setListenerin classAbstractUnmarshallerImpl
-
getContext
public UnmarshallingContext getContext()
-
finalize
protected void finalize() throws Throwable
-
close
public void close() throws IOExceptionMust be called from same thread which created the UnmarshallerImpl instance.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
-