Package org.infinispan.protostream.impl
Class SerializationContextImpl
java.lang.Object
org.infinispan.protostream.impl.SerializationContextImpl
- All Implemented Interfaces:
ImmutableSerializationContext
,SerializationContext
- Since:
- 1.0
- Author:
- [email protected]
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.infinispan.protostream.SerializationContext
SerializationContext.InstanceMarshallerProvider<T>, SerializationContext.MarshallerProvider
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
canMarshall
(Class<?> javaClass) Checks if the given type (message or enum) can be marshalled.boolean
canMarshall
(Object object) Checks if the given instance can be marshalled.boolean
canMarshall
(String fullTypeName) Checks if the given type (message or enum) can be marshalled.Get the (immutable) configuration object that was used when creating this context.getDescriptorByName
(String fullTypeName) Obtains the descriptor associated with a type name.getDescriptorByTypeId
(Integer typeId) Obtains the descriptor associated with a numeric type id.getEnumDescriptor
(String fullTypeName) Obtain the currently registered file descriptors.Obtain the currently registered type descriptors.<T> BaseMarshaller<T>
getMarshaller
(Class<T> clazz) Obtains the marshaller associated with a Java type.<T> BaseMarshaller<T>
getMarshaller
(String fullTypeName) Obtains the marshaller associated with a Protobuf type name.<T> BaseMarshaller<T>
getMarshaller
(T object) Obtains the marshaller associated with a given instance.<T> BaseMarshallerDelegate<T>
getMarshallerDelegate
(Class<T> javaClass) <T> BaseMarshallerDelegate<T>
getMarshallerDelegate
(String typeName) <T> BaseMarshallerDelegate<T>
getMarshallerDelegate
(T object) getMessageDescriptor
(String fullTypeName) getTypeIdByName
(String fullTypeName) Deprecated.getTypeNameById
(Integer typeId) Deprecated.void
registerMarshaller
(BaseMarshaller<?> marshaller) Register a type marshaller.void
registerMarshallerProvider
(SerializationContext.InstanceMarshallerProvider<?> marshallerProvider) void
registerMarshallerProvider
(SerializationContext.MarshallerProvider marshallerProvider) Deprecated.void
Register some proto schema definition files from aFileDescriptorSource
.void
unregisterMarshaller
(BaseMarshaller<?> marshaller) void
unregisterMarshallerProvider
(SerializationContext.InstanceMarshallerProvider<?> marshallerProvider) void
unregisterMarshallerProvider
(SerializationContext.MarshallerProvider marshallerProvider) Deprecated.void
unregisterProtoFile
(String fileName) Unregisters a file.void
unregisterProtoFiles
(Set<String> fileNames) Unregisters a set of files.
-
Constructor Details
-
SerializationContextImpl
-
-
Method Details
-
getConfiguration
Description copied from interface:ImmutableSerializationContext
Get the (immutable) configuration object that was used when creating this context.- Specified by:
getConfiguration
in interfaceImmutableSerializationContext
-
getFileDescriptors
Description copied from interface:ImmutableSerializationContext
Obtain the currently registered file descriptors.- Specified by:
getFileDescriptors
in interfaceImmutableSerializationContext
- Returns:
- an immutable copy of the internal map of descriptors
-
getGenericDescriptors
Description copied from interface:ImmutableSerializationContext
Obtain the currently registered type descriptors.- Specified by:
getGenericDescriptors
in interfaceImmutableSerializationContext
- Returns:
- an immutable copy of the internal map of descriptors
-
registerProtoFiles
Description copied from interface:SerializationContext
Register some proto schema definition files from aFileDescriptorSource
.- Specified by:
registerProtoFiles
in interfaceSerializationContext
- Throws:
DescriptorParserException
-
unregisterProtoFile
Description copied from interface:SerializationContext
Unregisters a file. All types defined in it are removed and also the types from all dependant files. The status of dependant files is set to 'unresolved'.- Specified by:
unregisterProtoFile
in interfaceSerializationContext
-
unregisterProtoFiles
Description copied from interface:SerializationContext
Unregisters a set of files. All types defined in them are removed and also the types from all dependant files. The status of dependant files is set to 'unresolved'.- Specified by:
unregisterProtoFiles
in interfaceSerializationContext
-
getMessageDescriptor
- Specified by:
getMessageDescriptor
in interfaceImmutableSerializationContext
-
getEnumDescriptor
- Specified by:
getEnumDescriptor
in interfaceImmutableSerializationContext
-
registerMarshaller
Description copied from interface:SerializationContext
Register a type marshaller.- Specified by:
registerMarshaller
in interfaceSerializationContext
- Parameters:
marshaller
- the marshaller instance
-
unregisterMarshaller
- Specified by:
unregisterMarshaller
in interfaceSerializationContext
-
registerMarshallerProvider
@Deprecated public void registerMarshallerProvider(SerializationContext.MarshallerProvider marshallerProvider) Deprecated.- Specified by:
registerMarshallerProvider
in interfaceSerializationContext
-
unregisterMarshallerProvider
@Deprecated public void unregisterMarshallerProvider(SerializationContext.MarshallerProvider marshallerProvider) Deprecated.- Specified by:
unregisterMarshallerProvider
in interfaceSerializationContext
-
registerMarshallerProvider
public void registerMarshallerProvider(SerializationContext.InstanceMarshallerProvider<?> marshallerProvider) - Specified by:
registerMarshallerProvider
in interfaceSerializationContext
-
unregisterMarshallerProvider
public void unregisterMarshallerProvider(SerializationContext.InstanceMarshallerProvider<?> marshallerProvider) - Specified by:
unregisterMarshallerProvider
in interfaceSerializationContext
-
canMarshall
Description copied from interface:ImmutableSerializationContext
Checks if the given type (message or enum) can be marshalled. This checks that a marshaller was registered for it.- Specified by:
canMarshall
in interfaceImmutableSerializationContext
- Parameters:
javaClass
- the object or enum class to check- Returns:
true
if a marshaller exists,false
otherwise
-
canMarshall
Description copied from interface:ImmutableSerializationContext
Checks if the given type (message or enum) can be marshalled. This checks that the Protobuf type was defined and a marshaller was registered for it.- Specified by:
canMarshall
in interfaceImmutableSerializationContext
- Parameters:
fullTypeName
- the fully qualified name of the Protobuf definition to check- Returns:
true
if a marshaller exists,false
otherwise
-
canMarshall
Description copied from interface:ImmutableSerializationContext
Checks if the given instance can be marshalled.- Specified by:
canMarshall
in interfaceImmutableSerializationContext
- Parameters:
object
- the instance- Returns:
true
if a marshaller exists,false
otherwise
-
getMarshaller
Description copied from interface:ImmutableSerializationContext
Obtains the marshaller associated with a given instance.- Specified by:
getMarshaller
in interfaceImmutableSerializationContext
- Parameters:
object
- the instance- Returns:
- the marshaller
-
getMarshaller
Description copied from interface:ImmutableSerializationContext
Obtains the marshaller associated with a Protobuf type name.- Specified by:
getMarshaller
in interfaceImmutableSerializationContext
- Parameters:
fullTypeName
- the type name- Returns:
- the marshaller
-
getMarshaller
Description copied from interface:ImmutableSerializationContext
Obtains the marshaller associated with a Java type.- Specified by:
getMarshaller
in interfaceImmutableSerializationContext
- Parameters:
clazz
- the class- Returns:
- the marshaller
-
getMarshallerDelegate
-
getMarshallerDelegate
-
getMarshallerDelegate
-
getTypeNameById
Deprecated.Description copied from interface:ImmutableSerializationContext
Obtains the Protobuf type name associated with a numeric type id.- Specified by:
getTypeNameById
in interfaceImmutableSerializationContext
- Parameters:
typeId
- the numeric type id- Returns:
- the fully qualified type name
-
getTypeIdByName
Deprecated.Description copied from interface:ImmutableSerializationContext
Obtains the associated numeric type id for a Protobuf type name, if a numeric id was defined.- Specified by:
getTypeIdByName
in interfaceImmutableSerializationContext
- Parameters:
fullTypeName
- the fully qualified type name- Returns:
- the type id or
null
if no type id is associated with the type
-
getDescriptorByName
Description copied from interface:ImmutableSerializationContext
Obtains the descriptor associated with a type name.- Specified by:
getDescriptorByName
in interfaceImmutableSerializationContext
- Parameters:
fullTypeName
- the fully qualified type name- Returns:
- the descriptor
-
getDescriptorByTypeId
Description copied from interface:ImmutableSerializationContext
Obtains the descriptor associated with a numeric type id.- Specified by:
getDescriptorByTypeId
in interfaceImmutableSerializationContext
- Parameters:
typeId
- the numeric type id- Returns:
- the descriptor
-