Class Loader
java.lang.Object
com.sun.xml.bind.v2.runtime.unmarshaller.Loader
- Direct Known Subclasses:
DefaultValueLoaderDecorator
,Discarder
,DomLoader
,LeafPropertyLoader
,LeafPropertyXsiLoader
,ProxyLoader
,StructureLoader
,TextLoader
,ValuePropertyLoader
,XsiTypeLoader
- Author:
- Kohsuke Kawaguchi
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
childElement
(UnmarshallingContext.State state, TagName ea) Called when this loaderis an active loaderand we see a new child start tag.final boolean
True if this loader expects thetext(UnmarshallingContext.State, CharSequence)
method to be called.protected final void
fireAfterUnmarshal
(JaxBeanInfo beanInfo, Object child, UnmarshallingContext.State state) Fires the afterUnmarshal event if necessary.protected final void
fireBeforeUnmarshal
(JaxBeanInfo beanInfo, Object child, UnmarshallingContext.State state) Fires the beforeUnmarshal event if necessary.Returns a set of tag names expected as possible child elements in this context.Returns a set of tag names expected as possible child elements in this context.static void
protected static void
Last resort when something goes terribly wrong within the unmarshaller.static void
handleGenericException
(Exception e, boolean canRecover) protected static void
This method is called by the generated derived class when a datatype parse method throws an exception.void
leaveElement
(UnmarshallingContext.State state, TagName ea) Called when this loaderis an active loaderand we see an end tag.protected static void
reportError
(String msg, boolean canRecover) static void
reportError
(String msg, Exception nested, boolean canRecover) protected final void
reportUnexpectedChildElement
(TagName ea, boolean canRecover) void
startElement
(UnmarshallingContext.State state, TagName ea) Called when the loader is activated, which is when a new start tag is seen and when the parent designated this loader as the child loader.void
text
(UnmarshallingContext.State state, CharSequence text) Called when this loaderis an active loaderand we see a chunk of text.
-
Field Details
-
expectText
protected boolean expectText
-
-
Constructor Details
-
Loader
protected Loader(boolean expectText) -
Loader
protected Loader()
-
-
Method Details
-
startElement
Called when the loader is activated, which is when a new start tag is seen and when the parent designated this loader as the child loader.The callee may change
state.loader
to designate anotherLoader
for the processing. It's the responsibility of the callee to forward the startElement event in such a case.- Parameters:
ea
- info about the start tag. never null.- Throws:
SAXException
-
childElement
Called when this loaderis an active loaderand we see a new child start tag.The callee is expected to designate another loaderas a loaderthat processes this element, then it should also register a
Receiver
. The designated loaderwill become an active loader.The default implementation reports an error saying an element is unexpected.
- Throws:
SAXException
-
reportUnexpectedChildElement
protected final void reportUnexpectedChildElement(TagName ea, boolean canRecover) throws SAXException - Throws:
SAXException
-
getExpectedChildElements
Returns a set of tag names expected as possible child elements in this context. -
getExpectedAttributes
Returns a set of tag names expected as possible child elements in this context. -
text
Called when this loaderis an active loaderand we see a chunk of text. The runtime makes sure that adjacent characters (even those separated by comments, PIs, etc) are reported as one event. IOW, you won't see two text event calls in a row.- Throws:
SAXException
-
expectText
public final boolean expectText()True if this loader expects thetext(UnmarshallingContext.State, CharSequence)
method to be called. False otherwise. -
leaveElement
Called when this loaderis an active loaderand we see an end tag.- Throws:
SAXException
-
fireBeforeUnmarshal
protected final void fireBeforeUnmarshal(JaxBeanInfo beanInfo, Object child, UnmarshallingContext.State state) throws SAXException Fires the beforeUnmarshal event if necessary.- Parameters:
state
- state of the newly create child object.- Throws:
SAXException
-
fireAfterUnmarshal
protected final void fireAfterUnmarshal(JaxBeanInfo beanInfo, Object child, UnmarshallingContext.State state) throws SAXException Fires the afterUnmarshal event if necessary.- Parameters:
state
- state of the parent object- Throws:
SAXException
-
handleGenericException
Last resort when something goes terribly wrong within the unmarshaller.- Throws:
SAXException
-
handleGenericException
- Throws:
SAXException
-
handleGenericError
- Throws:
SAXException
-
reportError
- Throws:
SAXException
-
reportError
public static void reportError(String msg, Exception nested, boolean canRecover) throws SAXException - Throws:
SAXException
-
handleParseConversionException
protected static void handleParseConversionException(UnmarshallingContext.State state, Exception e) throws SAXException This method is called by the generated derived class when a datatype parse method throws an exception.- Throws:
SAXException
-