Top Description Fields Constructors Methods
com.fasterxml.jackson.dataformat.xml.deser

public final Class XmlReadContext

extends JsonStreamContext
Class Inheritance
Imports
java.util.Set, com.fasterxml.jackson.core.*, com.fasterxml.jackson.core.io.CharTypes, .ContentReference

Extension of JsonStreamContext, which implements core methods needed, and adds small amount of additional state data we need.

Almost same as standard JsonReaderContext, but custom version needed to be able to keep track of names of properties that need wrapping; this is needed to support wrapped/unwrapped Collection/array values.

Field Summary

Modifier and TypeField and Description
protected XmlReadContext
protected int
protected String
protected Object
protected int
protected Set<String>
protected final XmlReadContext
protected String
_wrappedName

Name of property that requires wrapping

Inherited from com.fasterxml.jackson.core.JsonStreamContext:
_index_nestingDepth_typeTYPE_ARRAYTYPE_OBJECTTYPE_ROOT

Constructor Summary

AccessConstructor and Description
public
XmlReadContext(XmlReadContext parent, int nestingDepth, int type, int lineNr, int colNr)

public
XmlReadContext(XmlReadContext parent, int type, int lineNr, int colNr)
Deprecated Since 2.18

Method Summary

Modifier and TypeMethod and Description
protected void
public final XmlReadContext
createChildArrayContext(int lineNr, int colNr)

public final XmlReadContext
createChildObjectContext(int lineNr, int colNr)

public static XmlReadContext
createRootContext(int lineNr, int colNr)

public static XmlReadContext
public final String
getCurrentName()

Implements abstract com.fasterxml.jackson.core.JsonStreamContext.getCurrentName.

Method for accessing name associated with the current location.

public Object
getCurrentValue()

Overrides com.fasterxml.jackson.core.JsonStreamContext.getCurrentValue.

Method for accessing currently active value being used by data-binding (as the source of streaming data to write, or destination of data being read), at this level in hierarchy.

public final XmlReadContext
getParent()

Implements abstract com.fasterxml.jackson.core.JsonStreamContext.getParent.

Accessor for finding parent context of this context; will return null for root context.

public boolean
protected final void
reset(int type, int lineNr, int colNr)

public void
public void
setCurrentValue(Object
Current value to assign to this context
v
)

Overrides com.fasterxml.jackson.core.JsonStreamContext.setCurrentValue.

Method to call to pass value to be returned via getCurrentValue; typically called indirectly through JsonParser#setCurrentValue or JsonGenerator#setCurrentValue).

public void
setNamesToWrap(Set<String> namesToWrap)

public boolean
shouldWrap(String localName)

public final JsonLocation

Returns:

Location pointing to the point where the context start marker was found
startLocation
(ContentReference
Source reference needed to construct location instance
srcRef
)

Overrides com.fasterxml.jackson.core.JsonStreamContext.startLocation.

Optional method that may be used to access starting location of this context: for example, in case of JSON `Object` context, offset at which `[` token was read or written.

public final String
toString()

Overrides com.fasterxml.jackson.core.JsonStreamContext.toString.

Overridden to provide developer readable "JsonPath" representation of the context.

public final void
valueStarted()

Method called to mark start of new value, mostly to update `index` for Array and Root contexts.

Inherited from com.fasterxml.jackson.core.JsonStreamContext:
getCurrentIndexgetEntryCountgetNestingDepthgetStartLocationgetTypeDeschasCurrentIndexhasPathSegmentinArrayinObjectinRootpathAsPointerpathAsPointertypeDesc

Field Detail

_childback to summary
protected XmlReadContext _child
_columnNrback to summary
protected int _columnNr
_currentNameback to summary
protected String _currentName
_currentValueback to summary
protected Object _currentValue
Since
2.9
_lineNrback to summary
protected int _lineNr
_namesToWrapback to summary
protected Set<String> _namesToWrap
_parentback to summary
protected final XmlReadContext _parent
_wrappedNameback to summary
protected String _wrappedName

Name of property that requires wrapping

Constructor Detail

XmlReadContextback to summary
public XmlReadContext(XmlReadContext parent, int nestingDepth, int type, int lineNr, int colNr)
Since
2.18
XmlReadContextback to summary
public XmlReadContext(XmlReadContext parent, int type, int lineNr, int colNr)

Deprecated

Since 2.18

Annotations
@Deprecated

Method Detail

convertToArrayback to summary
protected void convertToArray()
createChildArrayContextback to summary
public final XmlReadContext createChildArrayContext(int lineNr, int colNr)
createChildObjectContextback to summary
public final XmlReadContext createChildObjectContext(int lineNr, int colNr)
createRootContextback to summary
public static XmlReadContext createRootContext(int lineNr, int colNr)
createRootContextback to summary
public static XmlReadContext createRootContext()
getCurrentNameback to summary
public final String getCurrentName()

Implements abstract com.fasterxml.jackson.core.JsonStreamContext.getCurrentName.

Doc from com.fasterxml.jackson.core.JsonStreamContext.getCurrentName.

Method for accessing name associated with the current location. Non-null for FIELD_NAME and value events that directly follow field names; null for root level and array values.

Returns:String

Current field name within context, if any; null if none

Annotations
@Override
getCurrentValueback to summary
public Object getCurrentValue()

Overrides com.fasterxml.jackson.core.JsonStreamContext.getCurrentValue.

Doc from com.fasterxml.jackson.core.JsonStreamContext.getCurrentValue.

Method for accessing currently active value being used by data-binding (as the source of streaming data to write, or destination of data being read), at this level in hierarchy.

Note that "current value" is NOT populated (or used) by Streaming parser or generator; it is only used by higher-level data-binding functionality. The reason it is included here is that it can be stored and accessed hierarchically, and gets passed through data-binding.

Returns:Object

Currently active value, if one has been assigned.

Annotations
@Override
getParentback to summary
public final XmlReadContext getParent()

Implements abstract com.fasterxml.jackson.core.JsonStreamContext.getParent.

Doc from com.fasterxml.jackson.core.JsonStreamContext.getParent.

Accessor for finding parent context of this context; will return null for root context.

Returns:XmlReadContext

Parent context of this context, if any; null for Root contexts

Annotations
@Override
hasCurrentNameback to summary
public boolean hasCurrentName()

Overrides com.fasterxml.jackson.core.JsonStreamContext.hasCurrentName.

Returns:boolean

Doc from com.fasterxml.jackson.core.JsonStreamContext.hasCurrentName.

True if a call to getCurrentName() would return non-null name; false otherwise

Annotations
@Override
resetback to summary
protected final void reset(int type, int lineNr, int colNr)
setCurrentNameback to summary
public void setCurrentName(String name)
setCurrentValueback to summary
public void setCurrentValue(Object v)

Overrides com.fasterxml.jackson.core.JsonStreamContext.setCurrentValue.

Doc from com.fasterxml.jackson.core.JsonStreamContext.setCurrentValue.

Method to call to pass value to be returned via getCurrentValue; typically called indirectly through JsonParser#setCurrentValue or JsonGenerator#setCurrentValue).

Parameters
v:Object

Current value to assign to this context

Annotations
@Override
setNamesToWrapback to summary
public void setNamesToWrap(Set<String> namesToWrap)
shouldWrapback to summary
public boolean shouldWrap(String localName)
startLocationback to summary
public final JsonLocation startLocation(ContentReference srcRef)

Overrides com.fasterxml.jackson.core.JsonStreamContext.startLocation.

Doc from com.fasterxml.jackson.core.JsonStreamContext.startLocation.

Optional method that may be used to access starting location of this context: for example, in case of JSON `Object` context, offset at which `[` token was read or written. Often used for error reporting purposes. Implementations that do not keep track of such location are expected to return JsonLocation#NA; this is what the default implementation does.

Parameters
srcRef:ContentReference

Source reference needed to construct location instance

Returns:JsonLocation

Location pointing to the point where the context start marker was found

Annotations
@Override
toStringback to summary
public final String toString()

Overrides com.fasterxml.jackson.core.JsonStreamContext.toString.

Overridden to provide developer readable "JsonPath" representation of the context.

Returns:String

Doc from com.fasterxml.jackson.core.JsonStreamContext.toString.

Simple developer-readable description this context layer (note: NOT constructed with parents, unlike pathAsPointer)

Annotations
@Override
valueStartedback to summary
public final void valueStarted()

Method called to mark start of new value, mostly to update `index` for Array and Root contexts.

Since
2.12