public final class UnmarshallingContext.State
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
java.lang.Object |
backup
Hack for making JAXBElement unmarshalling work.
|
java.lang.String |
elementDefaultValue
If this element has an element default value.
|
Intercepter |
intercepter |
Loader |
loader
Loader that owns this element.
|
boolean |
nil |
UnmarshallingContext.State |
prev
UnmarshallingContext.State for the parent element
UnmarshallingContext.State objects form a doubly linked list. |
Receiver |
receiver
Once
loader is completed, this receiver
receives the result. |
java.lang.Object |
target
Object being unmarshalled by this
loader . |
Modifier and Type | Method and Description |
---|---|
UnmarshallingContext |
getContext()
Gets the context.
|
public Loader loader
public Intercepter intercepter
public java.lang.Object target
loader
.public java.lang.Object backup
While the unmarshalling is in progress, the target
field stores the object being unmarshalled.
This makes it convenient to keep track of the unmarshalling activity in context of XML infoset, but
since there's only one UnmarshallingContext.State
per element, this mechanism only works when there's one object
per element, which breaks down when we have JAXBElement
, since the presence of JAXBElement
requires that we have two objects unmarshalled (a JAXBElement X and a value object Y bound to an XML type.)
So to make room for storing both, this backup
field is used. When we create X instance
in the above example, we set that to state.prev.target
and displace its old value to
state.prev.backup
(where Y goes to state.target
.) Upon the completion of the unmarshalling
of Y, we revert this.
While this attributes X incorrectly to its parent element, this preserves the parent/child
relationship between unmarshalled objects and UnmarshallingContext.State
parent/child relationship, and
it thereby makes Receiver
mechanism simpler.
Yes, I know this is a hack, and no, I'm not proud of it.
ElementBeanInfoImpl.IntercepterLoader#startElement(State, TagName)
,
ElementBeanInfoImpl.IntercepterLoader#intercept(State, Object)
public java.lang.String elementDefaultValue
public UnmarshallingContext.State prev
UnmarshallingContext.State
for the parent element
UnmarshallingContext.State
objects form a doubly linked list.public boolean nil
public UnmarshallingContext getContext()