Top Description Fields Constructors Methods
com.fasterxml.jackson.dataformat.protobuf

public final Class ProtobufReadContext

extends JsonStreamContext
Class Inheritance
Imports
com.fasterxml.jackson.core.*, com.fasterxml.jackson.core.io.CharTypes, .ContentReference, com.fasterxml.jackson.dataformat.protobuf.schema.ProtobufField, .ProtobufMessage

Replacement of com.fasterxml.jackson.core.json.JsonReadContext to support features needed to decode nested Protobuf messages.

Field Summary

Modifier and TypeField and Description
protected ProtobufReadContext
protected String
protected Object
protected int
_endOffset

Offset within input buffer where the message represented by this context (if message context) ends.

protected ProtobufField
_field

For array contexts: field that defines type of array values.

protected ProtobufMessage
_messageType

Type of current context.

protected final ProtobufReadContext
_parent

Parent context for this context; null for root context.

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

Constructor Summary

AccessConstructor and Description
public
ProtobufReadContext(ProtobufReadContext parent, ProtobufMessage messageType, int type, int endOffset)

Method Summary

Modifier and TypeMethod and Description
private void
_adjustEnd(int bytesConsumed)

public int
adjustEnd(int bytesConsumed)

Method called when loading more input, or moving existing data; this requires adjusting relative end offset as well, except for root context.

public ProtobufReadContext
public ProtobufReadContext
public ProtobufReadContext
public static ProtobufReadContext
public 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 int
public ProtobufField
public ProtobufMessage
public ProtobufReadContext
getParent()

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

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

protected void
reset(ProtobufMessage messageType, int type, int endOffset)

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
public JsonLocation

Returns:

Location pointing to the point where the context start marker was found
startLocation
(ContentReference srcRef, long byteOffset)

public String
toString()

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

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

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

Field Detail

_childback to summary
protected ProtobufReadContext _child
_currentNameback to summary
protected String _currentName
_currentValueback to summary
protected Object _currentValue
Since
2.9
_endOffsetback to summary
protected int _endOffset

Offset within input buffer where the message represented by this context (if message context) ends.

_fieldback to summary
protected ProtobufField _field

For array contexts: field that defines type of array values.

_messageTypeback to summary
protected ProtobufMessage _messageType

Type of current context.

_parentback to summary
protected final ProtobufReadContext _parent

Parent context for this context; null for root context.

Constructor Detail

ProtobufReadContextback to summary
public ProtobufReadContext(ProtobufReadContext parent, ProtobufMessage messageType, int type, int endOffset)

Method Detail

_adjustEndback to summary
private void _adjustEnd(int bytesConsumed)
adjustEndback to summary
public int adjustEnd(int bytesConsumed)

Method called when loading more input, or moving existing data; this requires adjusting relative end offset as well, except for root context.

createChildArrayContextback to summary
public ProtobufReadContext createChildArrayContext(ProtobufField f)
createChildArrayContextback to summary
public ProtobufReadContext createChildArrayContext(ProtobufField f, int endOffset)
createChildObjectContextback to summary
public ProtobufReadContext createChildObjectContext(ProtobufMessage messageType, ProtobufField f, int endOffset)
createRootContextback to summary
public static ProtobufReadContext createRootContext()
getCurrentNameback to summary
public 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
getEndOffsetback to summary
public int getEndOffset()
getFieldback to summary
public ProtobufField getField()
getMessageTypeback to summary
public ProtobufMessage getMessageType()
getParentback to summary
public ProtobufReadContext 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:ProtobufReadContext

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

Annotations
@Override
resetback to summary
protected void reset(ProtobufMessage messageType, int type, int endOffset)
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
setMessageTypeback to summary
public void setMessageType(ProtobufMessage mt)
startLocationback to summary
public JsonLocation startLocation(ContentReference srcRef, long byteOffset)
Returns:JsonLocation

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

toStringback to summary
public 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