com.sun.xml.bind.v2.runtime.unmarshaller
Class UnmarshallingContext.State

java.lang.Object
  extended by com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.State
Enclosing class:
UnmarshallingContext

public final class UnmarshallingContext.State
extends java.lang.Object

State information for each element.


Field Summary
 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.
 
Method Summary
 UnmarshallingContext getContext()
          Gets the context.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

loader

public Loader loader
Loader that owns this element.


receiver

public Receiver receiver
Once loader is completed, this receiver receives the result.


intercepter

public Intercepter intercepter

target

public java.lang.Object target
Object being unmarshalled by this loader.


backup

public java.lang.Object backup
Hack for making JAXBElement unmarshalling work.

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.

See Also:
ElementBeanInfoImpl.IntercepterLoader#startElement(State, TagName), ElementBeanInfoImpl.IntercepterLoader#intercept(State, Object)

elementDefaultValue

public java.lang.String elementDefaultValue
If this element has an element default value. This should be set by either a parent Loader when Loader#childElement(State, TagName) is called or by a child Loader when Loader#startElement(State, TagName) is called.


prev

public final UnmarshallingContext.State prev
UnmarshallingContext.State for the parent element UnmarshallingContext.State objects form a doubly linked list.


nil

public boolean nil
Method Detail

getContext

public UnmarshallingContext getContext()
Gets the context.