com.sun.xml.bind.v2.runtime.unmarshaller
Class UnmarshallerImpl

java.lang.Object
  extended by javax.xml.bind.helpers.AbstractUnmarshallerImpl
      extended by com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl
All Implemented Interfaces:
Closeable, 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
protected  JAXBContextImpl context
          Owning JAXBContext
 UnmarshallingContext coordinator
           
static String FACTORY
           
 
Fields inherited from class javax.xml.bind.helpers.AbstractUnmarshallerImpl
validating
 
Constructor Summary
UnmarshallerImpl(JAXBContextImpl context, AssociationMap assoc)
           
 
Method Summary
 void close()
          Must be called from same thread which created the UnmarshallerImpl instance.
 UnmarshalException createUnmarshalException(SAXException e)
           
 XmlVisitor createUnmarshallerHandler(InfosetScanner scanner, boolean inplace, JaxBeanInfo expectedType)
          Creates and configures a new unmarshalling pipe line.
protected  void finalize()
           
<A extends XmlAdapter>
A
getAdapter(Class<A> type)
           
 AttachmentUnmarshaller getAttachmentUnmarshaller()
           
<T> JaxBeanInfo<T>
getBeanInfo(Class<T> clazz)
           
 UnmarshallingContext getContext()
           
 ValidationEventHandler getEventHandler()
           
 Unmarshaller.Listener getListener()
           
 Object getProperty(String name)
           
 Schema getSchema()
           
 UnmarshallerHandler getUnmarshallerHandler()
           
 boolean handleEvent(ValidationEvent event)
          Default error handling behavior for Unmarshaller.
 boolean hasEventHandler()
          Returns true if an event handler is installed.
 boolean isValidating()
          Deprecated. since 2.0
static boolean needsInterning(XMLReader reader)
           
<A extends XmlAdapter>
void
setAdapter(Class<A> type, A adapter)
           
 void setAttachmentUnmarshaller(AttachmentUnmarshaller au)
           
 void setListener(Unmarshaller.Listener listener)
           
 void setProperty(String name, Object value)
           
 void setSchema(Schema schema)
           
 void setValidating(boolean validating)
          Deprecated. since 2.0
 Object unmarshal(Node node)
           
<T> JAXBElement<T>
unmarshal(Node node, Class<T> expectedType)
           
 Object unmarshal(SAXSource source)
          Deprecated. 
<T> JAXBElement<T>
unmarshal(Source source, Class<T> expectedType)
           
 Object unmarshal(javax.xml.stream.XMLEventReader reader)
           
<T> JAXBElement<T>
unmarshal(javax.xml.stream.XMLEventReader reader, Class<T> expectedType)
           
protected  Object unmarshal(XMLReader reader, InputSource source)
           
protected
<T> JAXBElement<T>
unmarshal(XMLReader reader, InputSource source, Class<T> expectedType)
           
 Object unmarshal(javax.xml.stream.XMLStreamReader reader)
           
<T> JAXBElement<T>
unmarshal(javax.xml.stream.XMLStreamReader reader, Class<T> expectedType)
           
 Object unmarshal0(InputStream input, JaxBeanInfo expectedType)
           
 Object unmarshal0(Node node, JaxBeanInfo expectedType)
           
 Object unmarshal0(Source source, JaxBeanInfo expectedType)
           
 Object unmarshal0(javax.xml.stream.XMLStreamReader reader, JaxBeanInfo expectedType)
           
 
Methods inherited from class javax.xml.bind.helpers.AbstractUnmarshallerImpl
getXMLReader, setAdapter, setEventHandler, unmarshal, unmarshal, unmarshal, unmarshal, unmarshal, unmarshal
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

context

protected final JAXBContextImpl context
Owning JAXBContext


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:
getUnmarshallerHandler in interface Unmarshaller

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 and ValidationEventHandler. 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:
unmarshal in class AbstractUnmarshallerImpl
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:
unmarshal in interface Unmarshaller
Overrides:
unmarshal in class AbstractUnmarshallerImpl
Throws:
JAXBException

unmarshal0

public Object unmarshal0(Source source,
                         JaxBeanInfo expectedType)
                  throws JAXBException
Throws:
JAXBException

getEventHandler

public final ValidationEventHandler getEventHandler()
Specified by:
getEventHandler in interface Unmarshaller
Overrides:
getEventHandler in class AbstractUnmarshallerImpl

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:
unmarshal in interface Unmarshaller
Overrides:
unmarshal in class AbstractUnmarshallerImpl
Throws:
JAXBException

unmarshal

public final Object unmarshal(Node node)
                       throws JAXBException
Specified by:
unmarshal in interface Unmarshaller
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(javax.xml.stream.XMLStreamReader reader)
                 throws JAXBException
Specified by:
unmarshal in interface Unmarshaller
Overrides:
unmarshal in class AbstractUnmarshallerImpl
Throws:
JAXBException

unmarshal

public <T> JAXBElement<T> unmarshal(javax.xml.stream.XMLStreamReader reader,
                                    Class<T> expectedType)
                         throws JAXBException
Specified by:
unmarshal in interface Unmarshaller
Overrides:
unmarshal in class AbstractUnmarshallerImpl
Throws:
JAXBException

unmarshal0

public Object unmarshal0(javax.xml.stream.XMLStreamReader reader,
                         JaxBeanInfo expectedType)
                  throws JAXBException
Throws:
JAXBException

unmarshal

public <T> JAXBElement<T> unmarshal(javax.xml.stream.XMLEventReader reader,
                                    Class<T> expectedType)
                         throws JAXBException
Specified by:
unmarshal in interface Unmarshaller
Overrides:
unmarshal in class AbstractUnmarshallerImpl
Throws:
JAXBException

unmarshal

public Object unmarshal(javax.xml.stream.XMLEventReader reader)
                 throws JAXBException
Specified by:
unmarshal in interface Unmarshaller
Overrides:
unmarshal in class AbstractUnmarshallerImpl
Throws:
JAXBException

unmarshal0

public Object unmarshal0(InputStream input,
                         JaxBeanInfo expectedType)
                  throws JAXBException
Throws:
JAXBException

getProperty

public Object getProperty(String name)
                   throws PropertyException
Specified by:
getProperty in interface Unmarshaller
Overrides:
getProperty in class AbstractUnmarshallerImpl
Throws:
PropertyException

setProperty

public void setProperty(String name,
                        Object value)
                 throws PropertyException
Specified by:
setProperty in interface Unmarshaller
Overrides:
setProperty in class AbstractUnmarshallerImpl
Throws:
PropertyException

setSchema

public void setSchema(Schema schema)
Specified by:
setSchema in interface Unmarshaller
Overrides:
setSchema in class AbstractUnmarshallerImpl

getSchema

public Schema getSchema()
Specified by:
getSchema in interface Unmarshaller
Overrides:
getSchema in class AbstractUnmarshallerImpl

getAttachmentUnmarshaller

public AttachmentUnmarshaller getAttachmentUnmarshaller()
Specified by:
getAttachmentUnmarshaller in interface Unmarshaller
Overrides:
getAttachmentUnmarshaller in class AbstractUnmarshallerImpl

setAttachmentUnmarshaller

public void setAttachmentUnmarshaller(AttachmentUnmarshaller au)
Specified by:
setAttachmentUnmarshaller in interface Unmarshaller
Overrides:
setAttachmentUnmarshaller in class AbstractUnmarshallerImpl

isValidating

public boolean isValidating()
Deprecated. since 2.0

Specified by:
isValidating in interface Unmarshaller
Overrides:
isValidating in class AbstractUnmarshallerImpl

setValidating

public void setValidating(boolean validating)
Deprecated. since 2.0

Specified by:
setValidating in interface Unmarshaller
Overrides:
setValidating in class AbstractUnmarshallerImpl

setAdapter

public <A extends XmlAdapter> void setAdapter(Class<A> type,
                                              A adapter)
Specified by:
setAdapter in interface Unmarshaller
Overrides:
setAdapter in class AbstractUnmarshallerImpl

getAdapter

public <A extends XmlAdapter> A getAdapter(Class<A> type)
Specified by:
getAdapter in interface Unmarshaller
Overrides:
getAdapter in class AbstractUnmarshallerImpl

createUnmarshalException

public UnmarshalException createUnmarshalException(SAXException e)
Overrides:
createUnmarshalException in class AbstractUnmarshallerImpl

handleEvent

public boolean handleEvent(ValidationEvent event)
Default error handling behavior for Unmarshaller.

Specified by:
handleEvent in interface ValidationEventHandler

getBeanInfo

public <T> JaxBeanInfo<T> getBeanInfo(Class<T> clazz)
                           throws JAXBException
Throws:
JAXBException

getListener

public Unmarshaller.Listener getListener()
Specified by:
getListener in interface Unmarshaller
Overrides:
getListener in class AbstractUnmarshallerImpl

setListener

public void setListener(Unmarshaller.Listener listener)
Specified by:
setListener in interface Unmarshaller
Overrides:
setListener in class AbstractUnmarshallerImpl

getContext

public UnmarshallingContext getContext()

finalize

protected void finalize()
                 throws Throwable
Overrides:
finalize in class Object
Throws:
Throwable

close

public void close()
           throws IOException
Must be called from same thread which created the UnmarshallerImpl instance.

Specified by:
close in interface Closeable
Throws:
IOException


Copyright © 2005-2011 Oracle Corporation. All Rights Reserved.