Top Inners Fields Constructors Methods
tools.jackson.dataformat.protobuf

public Class ProtobufMapper

extends ObjectMapper
Class Inheritance
Imports
java.io.File, .IOException, .InputStream, java.net.URL, java.util.Objects, java.util.concurrent.locks.ReentrantLock, tools.jackson.core.Version, tools.jackson.core.type.TypeReference, tools.jackson.databind.JavaType, .ObjectMapper, tools.jackson.databind.cfg.MapperBuilder, .MapperBuilderState, tools.jackson.dataformat.protobuf.schema.DescriptorLoader, .FileDescriptorSet, .ProtobufSchema, .ProtobufSchemaLoader, tools.jackson.dataformat.protobuf.schemagen.ProtobufSchemaGenerator

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
ProtobufMapper.Builder

Base implementation for "Vanilla" ObjectMapper, used with Protobuf backend.

private static class
ProtobufMapper.SharedWrapper

Helper class to contain dynamically constructed "shared" instance of mapper, should one be needed via shared.

Field Summary

Modifier and TypeField and Description
protected volatile DescriptorLoader
_descriptorLoader

Lazily constructed instance of DescriptorLoader, used for loading structured protoc definitions from multiple files.

private final ReentrantLock
protected ProtobufSchemaLoader
private static final long
Inherited from tools.jackson.databind.ObjectMapper:
_deserializationConfig_deserializationContexts_injectableValues_rootDeserializers_savedBuilderState_serializationConfig_serializationContexts_streamFactory_typeFactory

Constructor Summary

AccessConstructor and Description
public
public
public

Method Summary

Modifier and TypeMethod and Description
public static ProtobufMapper.Builder
public static ProtobufMapper.Builder
builder(ProtobufFactory streamFactory)

public DescriptorLoader
descriptorLoader()

Accessors that may be used instead of convenience loadDescriptorSet methods, if alternate sources need to be used.

public ProtobufSchema

Returns:

Generated ProtobufSchema
generateSchemaFor
(JavaType
Resolved type to generate ProtobufSchema for
type
)

Convenience method for constructing protoc definition that matches given Java type.

public ProtobufSchema

Returns:

Generated ProtobufSchema
generateSchemaFor
(Class<?>
Type-erased type to generate ProtobufSchema for
type
)

Convenience method for constructing protoc definition that matches given Java type.

public ProtobufSchema

Returns:

Generated ProtobufSchema
generateSchemaFor
(TypeReference<?>
Type to generate ProtobufSchema for
type
)

Convenience method for constructing protoc definition that matches given Java type.

public FileDescriptorSet
public FileDescriptorSet
public FileDescriptorSet
public ProtobufMapper.Builder
rebuild()

Overrides tools.jackson.databind.ObjectMapper.rebuild.

Method for creating a new MapperBuilder for constructing differently configured ObjectMapper instance, starting with current configuration including base settings and registered modules.

public ProtobufSchemaLoader
schemaLoader()

Accessor for reusable ProtobufSchemaLoader which can be used for loading protoc definitions from files and other external sources.

public void
public static ProtobufMapper
shared()

Accessor method for getting globally shared "default" ProtobufMapper instance: one that has default configuration, no modules registered, no config overrides.

public ProtobufFactory
tokenStreamFactory()

Overrides tools.jackson.databind.ObjectMapper.tokenStreamFactory.

Method that can be used to get hold of TokenStreamFactory that this mapper uses if it needs to construct JsonParsers and/or JsonGenerators.

public Version
version()

Overrides tools.jackson.databind.ObjectMapper.version.

Implements tools.jackson.core.Versioned.version.

Method that will return version information stored in and read from jar that contains this class.

Inherited from tools.jackson.databind.ObjectMapper:
_assertNotNull_configAndWriteValue_convert_deserializationContext_deserializationContext_deserializationContext_findRootDeserializer_initForReading_newReader_newReader_newWriter_newWriter_newWriter_readMapAndClose_readTreeAndClose_readValue_serializationContext_serializationContext_verifyNoTrailingTokens_verifySchemaType_writeCloseableValueacceptJsonFormatVisitoracceptJsonFormatVisitoracceptJsonFormatVisitorbooleanNodeclearCachesconstructTypeconstructTypeconvertValueconvertValueconvertValuecreateArrayNodecreateGeneratorcreateGeneratorcreateGeneratorcreateGeneratorcreateGeneratorcreateGeneratorcreateNonBlockingByteArrayParsercreateNonBlockingByteBufferParsercreateObjectNodecreateParsercreateParsercreateParsercreateParsercreateParsercreateParsercreateParsercreateParsercreateParsercreateParserdeserializationConfiggetInjectableValuesgetNodeFactorygetTypeFactoryisEnabledisEnabledisEnabledisEnabledisEnabledisEnabledisEnabledmissingNodenullNodereaderreaderreaderreaderreaderreaderreaderreaderreaderreaderForreaderForreaderForreaderForArrayOfreaderForListOfreaderForMapOfreaderForUpdatingreaderWithViewreadResolvereadTreereadTreereadTreereadTreereadTreereadTreereadTreereadTreereadTreereadValuereadValuereadValuereadValuereadValuereadValuereadValuereadValuereadValuereadValuereadValuereadValuereadValuereadValuereadValuereadValuereadValuereadValuereadValuereadValuereadValuereadValuereadValuereadValuereadValuereadValuereadValuereadValuereadValuereadValuereadValuereadValuesreadValuesreadValuesregisteredModulesserializationConfigstringNodetreeAsTokenstreeToValuetreeToValuetreeToValueupdateValuevalueToTreewriterwriterwriterwriterwriterwriterwriterwriterwriterwriterwriteReplacewriterForwriterForwriterForwriterWithDefaultPrettyPrinterwriterWithViewwriteTreewriteValuewriteValuewriteValuewriteValuewriteValuewriteValuewriteValueAsByteswriteValueAsStringwriteValueIntoBuffer

Field Detail

_descriptorLoaderback to summary
protected volatile DescriptorLoader _descriptorLoader

Lazily constructed instance of DescriptorLoader, used for loading structured protoc definitions from multiple files.

_descriptorLockback to summary
private final ReentrantLock _descriptorLock
_schemaLoaderback to summary
protected ProtobufSchemaLoader _schemaLoader
serialVersionUIDback to summary
private static final long serialVersionUID

Hides tools.jackson.databind.ObjectMapper.serialVersionUID.

Constructor Detail

ProtobufMapperback to summary
public ProtobufMapper()
ProtobufMapperback to summary
public ProtobufMapper(ProtobufFactory f)
ProtobufMapperback to summary
public ProtobufMapper(ProtobufMapper.Builder b)

Method Detail

builderback to summary
public static ProtobufMapper.Builder builder()
builderback to summary
public static ProtobufMapper.Builder builder(ProtobufFactory streamFactory)
descriptorLoaderback to summary
public DescriptorLoader descriptorLoader() throws IOException

Accessors that may be used instead of convenience loadDescriptorSet methods, if alternate sources need to be used.

generateSchemaForback to summary
public ProtobufSchema generateSchemaFor(JavaType type)

Convenience method for constructing protoc definition that matches given Java type. Uses ProtobufSchemaGenerator for generation.

Parameters
type:JavaType

Resolved type to generate ProtobufSchema for

Returns:ProtobufSchema

Generated ProtobufSchema

generateSchemaForback to summary
public ProtobufSchema generateSchemaFor(Class<?> type)

Convenience method for constructing protoc definition that matches given Java type. Uses ProtobufSchemaGenerator for generation.

Parameters
type:Class<?>

Type-erased type to generate ProtobufSchema for

Returns:ProtobufSchema

Generated ProtobufSchema

generateSchemaForback to summary
public ProtobufSchema generateSchemaFor(TypeReference<?> type)

Convenience method for constructing protoc definition that matches given Java type. Uses ProtobufSchemaGenerator for generation.

Parameters
type:TypeReference<?>

Type to generate ProtobufSchema for

Returns:ProtobufSchema

Generated ProtobufSchema

loadDescriptorSetback to summary
public FileDescriptorSet loadDescriptorSet(URL src) throws IOException
loadDescriptorSetback to summary
public FileDescriptorSet loadDescriptorSet(File src) throws IOException
loadDescriptorSetback to summary
public FileDescriptorSet loadDescriptorSet(InputStream src) throws IOException
rebuildback to summary
public ProtobufMapper.Builder rebuild()

Overrides tools.jackson.databind.ObjectMapper.rebuild.

Doc from tools.jackson.databind.ObjectMapper.rebuild.

Method for creating a new MapperBuilder for constructing differently configured ObjectMapper instance, starting with current configuration including base settings and registered modules.

Annotations
@SuppressWarnings:unchecked
@Override
schemaLoaderback to summary
public ProtobufSchemaLoader schemaLoader()

Accessor for reusable ProtobufSchemaLoader which can be used for loading protoc definitions from files and other external sources.

setSchemaLoaderback to summary
public void setSchemaLoader(ProtobufSchemaLoader l)
sharedback to summary
public static ProtobufMapper shared()

Accessor method for getting globally shared "default" ProtobufMapper instance: one that has default configuration, no modules registered, no config overrides. Usable mostly when dealing "untyped" or Tree-style content reading and writing.

tokenStreamFactoryback to summary
public ProtobufFactory tokenStreamFactory()

Overrides tools.jackson.databind.ObjectMapper.tokenStreamFactory.

Doc from tools.jackson.databind.ObjectMapper.tokenStreamFactory.

Method that can be used to get hold of TokenStreamFactory that this mapper uses if it needs to construct JsonParsers and/or JsonGenerators.

Warning

note that all ObjectReader and ObjectWriter instances created by this mapper usually share the same configured TokenStreamFactory, so changes to its configuration will "leak". To avoid such observed changes you should always use "with()" and "without()" method of ObjectReader and ObjectWriter for changing StreamReadFeature and StreamWriteFeature settings to use on per-call basis.

Annotations
@Override
versionback to summary
public Version version()

Overrides tools.jackson.databind.ObjectMapper.version.

Implements tools.jackson.core.Versioned.version.

Doc from tools.jackson.databind.ObjectMapper.version.

Method that will return version information stored in and read from jar that contains this class.

Annotations
@Override
tools.jackson.dataformat.protobuf back to summary

public Class ProtobufMapper.Builder

extends MapperBuilder<ProtobufMapper, ProtobufMapper.Builder>
Class Inheritance

Base implementation for "Vanilla" ObjectMapper, used with Protobuf backend.
Since
3.0

Nested and Inner Type Summary

Modifier and TypeClass and Description
protected static class

Field Summary

Inherited from tools.jackson.databind.cfg.MapperBuilder:
_abstractTypeResolvers_baseSettings_classIntrospector_coercionConfigs_configOverrides_datatypeFeatures_defaultAttributes_defaultPrettyPrinter_deserFeatures_deserializationContexts_deserializerFactory_filterProvider_formatReadFeatures_formatWriteFeatures_injectableValues_mapperFeatures_mixInHandler_modules_problemHandlers_savedState_serFeatures_serializationContexts_serializerFactory_streamFactory_streamReadFeatures_streamWriteFeatures_subtypeResolver_typeFactory_typeResolverProviderDEFAULT_ACCESSOR_NAMINGDEFAULT_ANNOTATION_INTROSPECTORDEFAULT_BASE_SETTINGSDEFAULT_DESER_FEATURESDEFAULT_MAPPER_FEATURESDEFAULT_PRETTY_PRINTERDEFAULT_SER_FEATURESDEFAULT_TYPE_RESOLVER_PROVIDERDEFAULT_TYPE_VALIDATORNO_ABSTRACT_TYPE_RESOLVERS

Constructor Summary

AccessConstructor and Description
public
public
Builder(ProtobufMapper.Builder.StateImpl
State to restore to initialize constructed Builder
state
)

Note

while technically public, not intended for external use (since StateImpl is not public type)

Method Summary

Modifier and TypeMethod and Description
protected MapperBuilderState
public ProtobufMapper
build()

Implements abstract tools.jackson.databind.cfg.MapperBuilder.build.

Method to call to create actual mapper instance.

Inherited from tools.jackson.databind.cfg.MapperBuilder:
_constructModuleContext_defaultClassIntrospector_defaultDefaultAttributes_defaultDefaultTypingResolver_defaultDefaultTypingResolver_defaultDeserializationContexts_defaultMixInHandler_defaultPrettyPrinter_defaultSerializationContexts_defaultSerializerFactory_defaultSubtypeResolver_defaultTypeFactory_defaultTypeResolverProvider_thisaccessorNamingactivateDefaultTypingactivateDefaultTypingactivateDefaultTypingactivateDefaultTypingAsPropertyaddAbstractTypeResolveraddHandleraddMixInaddMixInsaddModuleaddModulesaddModulesaddTypeModifierannotationIntrospectorannotationIntrospectorbaseSettingsbaseSettingsbuildDeserializationConfigbuildSerializationConfigcacheProviderchangeDefaultNullHandlingchangeDefaultPropertyInclusionchangeDefaultVisibilityclassIntrospectorclassIntrospectorclearProblemHandlersconfigureconfigureconfigureconfigureconfigureconfigureconfigureForJackson2constructorDetectordatatypeFeaturesdeactivateDefaultTypingdefaultAttributesdefaultAttributesdefaultBase64VariantdefaultDateFormatdefaultLeniencydefaultLocaledefaultMergeabledefaultPrettyPrinterdefaultPrettyPrinterdefaultTimeZonedeserializationContextsdeserializationContextsdeserializationProblemHandlersdeserializerFactorydeserializerFactorydisabledisabledisabledisabledisabledisableenableenableenableenableenableenableenumNamingStrategyfilterProviderfilterProviderfindAndAddModulesfindAndAddModulesfindModulesfindModuleshandlerInstantiatorinjectableValuesinjectableValuesisEnabledisEnabledisEnabledisEnabledisEnabledisEnabledmixInHandlermixInHandlermixInOverridesnodeFactorypolymorphicTypeValidatorpropertyNamingStrategyregisterSubtypesregisterSubtypesregisterSubtypesremoveAllModulesremoveMixInsaveStateApplyModulesserializationContextsserializationContextsserializerFactoryserializerFactorysetDefaultTypingstreamFactorysubtypeResolversubtypeResolvertypeFactorytypeFactorytypeResolverProvidertypeResolverProviderwithAllCoercionConfigswithAllConfigOverrideswithCoercionConfigwithCoercionConfigwithCoercionConfigDefaultswithConfigOverridewithModules

Constructor Detail

Builderback to summary
public Builder(ProtobufFactory f)
Builderback to summary
public Builder(ProtobufMapper.Builder.StateImpl state)

Note

while technically public, not intended for external use (since StateImpl is not public type)

Parameters
state:ProtobufMapper.Builder.StateImpl

State to restore to initialize constructed Builder

Annotations
@SuppressWarnings:exports

Method Detail

_saveStateback to summary
protected MapperBuilderState _saveState()

Implements abstract tools.jackson.databind.cfg.MapperBuilder._saveState.

Annotations
@Override
buildback to summary
public ProtobufMapper build()

Implements abstract tools.jackson.databind.cfg.MapperBuilder.build.

Doc from tools.jackson.databind.cfg.MapperBuilder.build.

Method to call to create actual mapper instance.

Implementation detail: usually construction occurs by passing this builder instance to constructor of specific mapper type builder builds.

Annotations
@Override
tools.jackson.dataformat.protobuf back to summary

protected Class ProtobufMapper.Builder.StateImpl

extends MapperBuilderState
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected Object
readResolve()

Implements abstract tools.jackson.databind.cfg.MapperBuilderState.readResolve.

Method required to support JDK deserialization; made `abstract` here to ensure sub-classes must implement it.

Inherited from tools.jackson.databind.cfg.MapperBuilderState:
modules

Field Detail

serialVersionUIDback to summary
private static final long serialVersionUID

Hides tools.jackson.databind.cfg.MapperBuilderState.serialVersionUID.

Constructor Detail

StateImplback to summary
public StateImpl(ProtobufMapper.Builder src)

Method Detail

readResolveback to summary
protected Object readResolve()

Implements abstract tools.jackson.databind.cfg.MapperBuilderState.readResolve.

Doc from tools.jackson.databind.cfg.MapperBuilderState.readResolve.

Method required to support JDK deserialization; made `abstract` here to ensure sub-classes must implement it.

Annotations
@Override
tools.jackson.dataformat.protobuf back to summary

private final Class ProtobufMapper.SharedWrapper

extends Object
Class Inheritance
  • java.lang.Object
  • tools.jackson.dataformat.protobuf.ProtobufMapper.SharedWrapper

Helper class to contain dynamically constructed "shared" instance of mapper, should one be needed via shared.

Field Summary

Modifier and TypeField and Description
private static final ProtobufMapper

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static ProtobufMapper
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

MAPPERback to summary
private static final ProtobufMapper MAPPER

Constructor Detail

SharedWrapperback to summary
private SharedWrapper()

Method Detail

wrappedback to summary
public static ProtobufMapper wrapped()