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

public Class ProtobufSchema

extends Object
implements FormatSchema
Class Inheritance
All Implemented Interfaces
com.fasterxml.jackson.core.FormatSchema
Imports
java.util.List, com.fasterxml.jackson.core.FormatSchema

A FormatSchema implementation for protobuf, bound to specific root-level ProtobufMessage, and useful for reading/writing protobuf content that encodes instance of that message.

Field Summary

Modifier and TypeField and Description
protected final ProtobufMessage
protected final NativeProtobufSchema
_source

In case we want to use a different root type, we'll also hold a reference to the native definition, if one is available.

public static final String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public List<String>
getMessageTypes()

Accessor for listing names of all root-level messages defined in the original protoc.

public ProtobufMessage
getRootType()

Accessor for getting the default ProtobufMessage type that is usually the root type for this schema.

public String
getSchemaType()

Implements com.fasterxml.jackson.core.FormatSchema.getSchemaType.

Accessor to get type id for this FormatSchema, used by code Jackson databinding functionality.

public NativeProtobufSchema
getSource()

Accessor for native representation of the protoc.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

public ProtobufSchema
withRootType(String typeName)

Method that can be called to choose different root type (of types defined in protoc); a new schema instance will be constructed if type is different from current root type.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

_rootTypeback to summary
protected final ProtobufMessage _rootType
_sourceback to summary
protected final NativeProtobufSchema _source

In case we want to use a different root type, we'll also hold a reference to the native definition, if one is available. Note that it may be possible to construct instances directly, in which case this would be `null`.

FORMAT_NAME_PROTOBUFback to summary
public static final String FORMAT_NAME_PROTOBUF

Constructor Detail

ProtobufSchemaback to summary
public ProtobufSchema(NativeProtobufSchema src, ProtobufMessage rootType)

Method Detail

getMessageTypesback to summary
public List<String> getMessageTypes()

Accessor for listing names of all root-level messages defined in the original protoc.

getRootTypeback to summary
public ProtobufMessage getRootType()

Accessor for getting the default ProtobufMessage type that is usually the root type for this schema.

getSchemaTypeback to summary
public String getSchemaType()

Implements com.fasterxml.jackson.core.FormatSchema.getSchemaType.

Accessor to get type id for this FormatSchema, used by code Jackson databinding functionality. Not usually needed by application developers.

Returns:String

Doc from com.fasterxml.jackson.core.FormatSchema.getSchemaType.

Logical name of schema type

Annotations
@Override
getSourceback to summary
public NativeProtobufSchema getSource()

Accessor for native representation of the protoc. Mostly useful for debugging; application code should not need to access this representation during normal operation.

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override
withRootTypeback to summary
public ProtobufSchema withRootType(String typeName) throws IllegalArgumentException

Method that can be called to choose different root type (of types defined in protoc); a new schema instance will be constructed if type is different from current root type.

Note that cost of changing root type is non-trivial in that traversal of types defined is needed -- but exact cost depends on number of types defined. Since schema instances are immutable, it makes sense to try to reuse instances if possible.

Exceptions
IllegalArgumentException:
If no type with specified name is found from within this schema.