public interface IParseContext extends ILookup
All state data that is needed for the parsing of a concrete input should go here, allowing all handlers and deserializers to be implemented stateless.
Modifier and Type | Method and Description |
---|---|
<T> T |
deserialize(Class<T> targetType,
IParseContext context,
Node targetNode)
Deserialize the object representation in .
|
default <T> T |
deserialize(Class<T> targetType,
Node targetNode)
Deserialize the object representation in
targetNode . |
<T> T |
getCurrent()
Returns the most current (the last element) within the container hierarchy as it is returned by
ObjectStack
or default(T) if the most current element is not of the desired target type. |
<T> T |
getDeserializationProperty(TypedKey<T> key)
Get a property value that specifies information about how to handle specific cases.
|
IGraph |
getGraph()
Returns the currently active graph object.
|
IListEnumerable<Object> |
getObjectStack()
Returns the current nesting of created graphs and graph elements.
|
IParseEvents |
getParseEvents()
Returns an implementation of
IParseEvents that allows to subscribe to various events in the parse process. |
createDictionaryLookup, createDynamic, createSingle, createSingle, createWrapped, lookup, lookup, lookup, safeLookup
<T> T deserialize(Class<T> targetType, IParseContext context, Node targetNode)
targetNode
Client code should usually use the extension method deserialize(Class, Node)
instead to ensure the the correct
context
instance is used.
T
- The expected return type.targetType
- The expected return type.context
- The current parse context.targetNode
- The XML node that should be deserialized.targetNode
or an DeserializationNotSupportedException
if targetNode
could not be deserialized.deserialize(Class, Node)
default <T> T deserialize(Class<T> targetType, Node targetNode)
targetNode
.
This method calls deserialize(Class, IParseContext, Node)
with context
as first argument and should be
used in virtually all cases.
DeserializationNotSupportedException
T
- The desired target type.targetType
- The desired target type.targetNode
- The XML node that should be deserialized.T
or null
.deserialize(Class, IParseContext, Node)
<T> T getCurrent()
ObjectStack
or default(T)
if the most current element is not of the desired target type.T
- The desired target type.default(T)
.<T> T getDeserializationProperty(TypedKey<T> key)
key
- The identifier for the propertynull
if no such property exists.IGraph getGraph()
IListEnumerable<Object> getObjectStack()
The list contains the user objects which correspond to the GraphML elements which are ancestors of the current node in the DOM tree.
IParseEvents getParseEvents()
IParseEvents
that allows to subscribe to various events in the parse process.