|
JAXB v0.21 |
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Object | +--javax.xml.bind.Unmarshaller
An unmarshaller governs the process of unmarshalling an XML document into a newly-created content tree, validating the tree as it is constructed. It encapsulates the dispatcher, scanner, and validator objects used during an unmarshalling operation, and it provides the basic unmarshalling methods.
The process of unmarshalling a content tree begins when one of the
unmarshal methods of a Dispatcher object is invoked. (An
unmarshalling operation may also be initiated by invoking one of the static
methods in each marshallable root element class generated by the schema
compiler.) These methods examine the given scanner's current state, if
necessary, in order to locate the element class to be unmarshalled. They
then create a new unmarshaller from the dispatcher, the given scanner, and a
new validator. Finally, the new unmarshaller's unmarshal(Class)
method is invoked, passing the element class. After this method returns the
validator is used to resolve any pending identifier references and check any
global constraints.
The unmarshalling process makes the same guarantees as the validation process. If unmarshalling completes successfully then the validation propositions are guaranteed to hold for every member of the resulting content tree. It is also guaranteed that the target of every identifier reference exists.
This class does not have any public or protected constructors; it is intended only for use by the unmarshalling process.
Dispatcher,
Validator,
XMLScanner| Method Summary | |
XMLScanner |
scanner()
Returns the scanner to be used during this unmarshalling operation. |
MarshallableObject |
unmarshal()
Unmarshals the next element in this unmarshaller's scanner and validates the resulting instance subtree. |
MarshallableObject |
unmarshal(Class mobClass)
Unmarshals the next element in this unmarshaller's scanner, using the given schema-derived marshallable-object class, and validates the resulting subtree. |
Validator |
validator()
Returns the validator to be used during this unmarshalling operation. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
public XMLScanner scanner()
public MarshallableObject unmarshal()
throws UnmarshalException
This method examines the scanner's current start tag, uses the
dispatcher to map it to a marshallable-object class, and then passes the
resulting class to the unmarshal(Class) method.
InvalidContentException - If the scanner is not currently positioned at a start tag,
or if some other invalid content is later encounteredUnrecognizedElementNameException - If the element name in the current start tag is not registered
in this unmarshaller's dispatcher, or if some other
unrecognized element name is later encounteredScanIOException - If an I/O error occursScanException - If the input document is not well-formedValidationException - If the input document violates the constraints
expressed in the source schema, or some other
validation error is detected
public MarshallableObject unmarshal(Class mobClass)
throws UnmarshalException
This method applies the dispatcher's class map to the given
marshallable class and creates an instance of the resulting class. It
then invokes the unmarshal(Unmarshaller) method of the new instance, passing this
unmarshaller in order to unmarshal recursively the element and its
subelements, if any. Once the new instance has been unmarshalled it is
locally validated by invoking its validateThis() method. If the
instance implements the IdentifiableElement interface and has an
identifier then the validator is updated with that identifier value.
NonInitialObjectException - If the instantiated class modified the instance in any way
during its initializationInvalidContentException - If the scanner is not currently positioned at a start tag,
or if some other invalid content is later encounteredUnrecognizedElementNameException - If the element name in the current start tag is not the element
name handled by the given class, or if some other unrecognized
element name is later encounteredScanIOException - If an I/O error occursScanException - If the input document is not well-formedValidationException - If the input document violates the constraints
expressed in the source schema, or some other
validation error is detectedpublic Validator validator()
|
JAXB v0.21 |
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
Copyright © 2001 by Sun Microsystems, Inc., 901 San Antonio Road,
Palo Alto, California, 94303, U.S.A. All Rights Reserved.