Class ProtobufSchema
java.lang.Object
tools.jackson.dataformat.protobuf.schema.ProtobufSchema
- All Implemented Interfaces:
tools.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
FieldsModifier and TypeFieldDescriptionprotected final ProtobufMessageprotected final NativeProtobufSchemaIn case we want to use a different root type, we'll also hold a reference to the native definition, if one is available.static final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAccessor for listing names of all root-level messages defined in the original protoc.Accessor for getting the defaultProtobufMessagetype that is usually the root type for this schema.Accessor to get type id for thisFormatSchema, used by code Jackson databinding functionality.Accessor for native representation of the protoc.toString()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.
-
Field Details
-
FORMAT_NAME_PROTOBUF
- See Also:
-
_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`. -
_rootType
-
-
Constructor Details
-
ProtobufSchema
-
-
Method Details
-
withRootType
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.
- Throws:
IllegalArgumentException- If no type with specified name is found from within this schema.
-
getSource
Accessor for native representation of the protoc. Mostly useful for debugging; application code should not need to access this representation during normal operation. -
getRootType
Accessor for getting the defaultProtobufMessagetype that is usually the root type for this schema. -
getMessageTypes
Accessor for listing names of all root-level messages defined in the original protoc. -
getSchemaType
Accessor to get type id for thisFormatSchema, used by code Jackson databinding functionality. Not usually needed by application developers.- Specified by:
getSchemaTypein interfacetools.jackson.core.FormatSchema
-
toString
-