This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.


javax.xml.bind.helpers
class AbstractUnmarshallerImpl

java.lang.Object extended by javax.xml.bind.helpers.AbstractUnmarshallerImpl
All Implemented Interfaces:
Unmarshaller

public abstract class AbstractUnmarshallerImpl
extends Object
implements Unmarshaller

Partial default Unmarshaller implementation.

This class provides a partial default implementation for the {@link javax.xml.bind.Unmarshaller}interface.

A JAXB Provider has to implement five methods (getUnmarshallerHandler, unmarshal(Node), unmarshal(XMLReader,InputSource), unmarshal(XMLStreamReader), and unmarshal(XMLEventReader).


Field Summary
protected boolean validating
          whether or not the unmarshaller will validate
 
Constructor Summary

          
 
Method Summary
protected UnmarshalException

          Creates an UnmarshalException from a SAXException.
 XmlAdapter

          
 AttachmentUnmarshaller

          
 ValidationEventHandler

          Return the current event handler or the default event handler if one hasn't been set.
 Unmarshaller.Listener

          
 Object

          Default implementation of the getProperty method always throws PropertyException since there are no required properties.
 Schema

          
protected XMLReader

          Obtains a configured XMLReader.
 boolean

          Indicates whether or not the Unmarshaller is configured to validate during unmarshal operations.
 void
setAdapter(Class type, XmlAdapter adapter)

          
 void

          
 void

          
 void

          Allow an application to register a validation event handler.
 void

          
 void
setProperty(String name, Object value)

          Default implementation of the setProperty method always throws PropertyException since there are no required properties.
 void
setSchema(Schema schema)

          
 void
setValidating(boolean validating)

          Specifies whether or not the Unmarshaller should validate during unmarshal operations.
 Object

          
 Object

          
 Object

          
 JAXBElement
unmarshal(Node node, Class expectedType)

          
 Object
unmarshal(Reader reader)

          
 Object
unmarshal(Source source)

          
 JAXBElement
unmarshal(Source source, Class expectedType)

          
 Object

          
 Object

          
 JAXBElement
unmarshal(XMLEventReader reader, Class expectedType)

          
protected abstract Object
unmarshal(XMLReader reader, InputSource source)

          Unmarshals an object by using the specified XMLReader and the InputSource.
 Object

          
 JAXBElement
unmarshal(XMLStreamReader reader, Class expectedType)

          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

validating

protected boolean validating
whether or not the unmarshaller will validate
Constructor Detail

AbstractUnmarshallerImpl

public AbstractUnmarshallerImpl()
Method Detail

createUnmarshalException

protected UnmarshalException createUnmarshalException(SAXException e)
Creates an UnmarshalException from a SAXException. This is an utility method provided for the derived classes.

When a provider-implemented ContentHandler wants to throw a JAXBException, it needs to wrap the exception by a SAXException. If the unmarshaller implementation blindly wrap SAXException by JAXBException, such an exception will be a JAXBException wrapped by a SAXException wrapped by another JAXBException. This is silly.

This method checks the nested exception of SAXException and reduce those excessive wrapping.

Parameters:
e
Returns:
the resulting UnmarshalException

getAdapter

public XmlAdapter getAdapter(Class type)
Parameters:
type

getAttachmentUnmarshaller

public AttachmentUnmarshaller getAttachmentUnmarshaller()

getEventHandler

public ValidationEventHandler getEventHandler()
                                       throws JAXBException
Return the current event handler or the default event handler if one hasn't been set.

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

getListener

public Unmarshaller.Listener getListener()

getProperty

public Object getProperty(String name)
                   throws PropertyException
Default implementation of the getProperty method always throws PropertyException since there are no required properties. If a provider needs to handle additional properties, it should override this method in a derived class.

Parameters:
name
Throws:
PropertyException

getSchema

public Schema getSchema()

getXMLReader

protected XMLReader getXMLReader()
                          throws JAXBException
Obtains a configured XMLReader. This method is used when the client-specified {@link SAXSource} object doesn't have XMLReader. {@link Unmarshaller} is not re-entrant, so we will only use one instance of XMLReader.

Throws:
JAXBException

isValidating

public boolean isValidating()
                     throws JAXBException
Indicates whether or not the Unmarshaller is configured to validate during unmarshal operations.

Note: I named this method isValidating() to stay in-line with JAXP, as opposed to naming it getValidating().

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

setAdapter

public void setAdapter(Class type,
                       XmlAdapter adapter)
Parameters:
type
adapter

setAdapter

public void setAdapter(XmlAdapter adapter)
Parameters:
adapter

setAttachmentUnmarshaller

public void setAttachmentUnmarshaller(AttachmentUnmarshaller au)
Parameters:
au

setEventHandler

public void setEventHandler(ValidationEventHandler handler)
                     throws JAXBException
Allow an application to register a validation event handler.

The validation event handler will 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 a validation event handler before invoking the unmarshal methods, then all validation events will be silently ignored and may result in unexpected behaviour.

Parameters:
handler - the validation event handler
Throws:
JAXBException - if an error was encountered while setting the event handler

setListener

public void setListener(Unmarshaller.Listener listener)
Parameters:
listener

setProperty

public void setProperty(String name,
                        Object value)
                 throws PropertyException
Default implementation of the setProperty method always throws PropertyException since there are no required properties. If a provider needs to handle additional properties, it should override this method in a derived class.

Parameters:
name
value
Throws:
PropertyException

setSchema

public void setSchema(Schema schema)
Parameters:
schema

setValidating

public void setValidating(boolean validating)
                   throws JAXBException
Specifies whether or not the Unmarshaller should validate during unmarshal operations. By default, the Unmarshaller does not validate.

This method may only be invoked before or after calling one of the unmarshal methods.

Parameters:
validating - true if the Unmarshaller should validate during unmarshal, false otherwise
Throws:
JAXBException - if an error occurred while enabling or disabling validation at unmarshal time

unmarshal

public final Object unmarshal(File f)
                       throws JAXBException
Parameters:
f
Throws:
JAXBException

unmarshal

public final Object unmarshal(InputSource source)
                       throws JAXBException
Parameters:
source
Throws:
JAXBException

unmarshal

public final Object unmarshal(InputStream is)
                       throws JAXBException
Parameters:
is
Throws:
JAXBException

unmarshal

public JAXBElement unmarshal(Node node,
                             Class expectedType)
                      throws JAXBException
Parameters:
node
expectedType
Throws:
JAXBException

unmarshal

public final Object unmarshal(Reader reader)
                       throws JAXBException
Parameters:
reader
Throws:
JAXBException

unmarshal

public Object unmarshal(Source source)
                 throws JAXBException
Parameters:
source
Throws:
JAXBException

unmarshal

public JAXBElement unmarshal(Source source,
                             Class expectedType)
                      throws JAXBException
Parameters:
source
expectedType
Throws:
JAXBException

unmarshal

public final Object unmarshal(URL url)
                       throws JAXBException
Parameters:
url
Throws:
JAXBException

unmarshal

public Object unmarshal(XMLEventReader reader)
                 throws JAXBException
Parameters:
reader
Throws:
JAXBException

unmarshal

public JAXBElement unmarshal(XMLEventReader reader,
                             Class expectedType)
                      throws JAXBException
Parameters:
reader
expectedType
Throws:
JAXBException

unmarshal

protected abstract Object unmarshal(XMLReader reader,
                                    InputSource source)
                             throws JAXBException
Unmarshals an object by using the specified XMLReader and the InputSource. The callee should call the setErrorHandler method of the XMLReader so that errors are passed to the client-specified ValidationEventHandler.

Parameters:
reader
source
Throws:
JAXBException

unmarshal

public Object unmarshal(XMLStreamReader reader)
                 throws JAXBException
Parameters:
reader
Throws:
JAXBException

unmarshal

public JAXBElement unmarshal(XMLStreamReader reader,
                             Class expectedType)
                      throws JAXBException
Parameters:
reader
expectedType
Throws:
JAXBException


This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.
This page displays the Jadeite version of the documention, which is derived from the offical documentation that contains this copyright notice:
Copyright 2008 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
The official Sun™ documentation can be found here at http://java.sun.com/javase/6/docs/api/.