Package org.infinispan.protostream.impl
Class SerializationContextImpl
java.lang.Object
org.infinispan.protostream.impl.SerializationContextImpl
- All Implemented Interfaces:
ImmutableSerializationContext,SerializationContext
- Since:
- 1.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final classNested classes/interfaces inherited from interface org.infinispan.protostream.SerializationContext
SerializationContext.InstanceMarshallerProvider<T>, SerializationContext.MarshallerProvider -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Configurationprivate final StampedLockAll descriptor related mutable internal state is protected by this RW lock.(package private) static final Class<?>[]private final Map<String, EnumValueDescriptor> private final Map<String, FileDescriptor> private final Map<String, GenericDescriptor> private final List<SerializationContext.MarshallerProvider> private static final Logprivate final StampedLockAll marshaller related mutable internal state is protected by this RW lock.private final Map<Class<?>, SerializationContextImpl.Registration> private final Map<String, SerializationContextImpl.Registration> private final ProtostreamProtoParserprivate final Map<Integer, GenericDescriptor> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancanMarshall(Class<?> javaClass) Checks if the given type (message or enum) can be marshalled.booleancanMarshall(Object object) Checks if the given instance can be marshalled.booleancanMarshall(String fullTypeName) Checks if the given type (message or enum) can be marshalled.(package private) static Class<?> classForName(String name) 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) private <T> BaseMarshaller<T> getMarshallerFromLegacyProvider(Class<T> javaClass) private <T> BaseMarshaller<T> getMarshallerFromLegacyProvider(String fullTypeName) getMessageDescriptor(String fullTypeName) getTypeIdByName(String fullTypeName) Deprecated.getTypeNameById(Integer typeId) Deprecated.private <T> BaseMarshallerDelegate<T> makeMarshallerDelegate(BaseMarshaller<T> marshaller) voidregisterMarshaller(BaseMarshaller<?> marshaller) Register a type marshaller.voidregisterMarshallerProvider(SerializationContext.InstanceMarshallerProvider<?> marshallerProvider) voidregisterMarshallerProvider(SerializationContext.MarshallerProvider marshallerProvider) Deprecated.voidRegister some proto schema definition files from aFileDescriptorSource.private voidunregisterFileDescriptorTypes(FileDescriptor fileDescriptor) voidunregisterMarshaller(BaseMarshaller<?> marshaller) voidunregisterMarshallerProvider(SerializationContext.InstanceMarshallerProvider<?> marshallerProvider) voidunregisterMarshallerProvider(SerializationContext.MarshallerProvider marshallerProvider) Deprecated.voidunregisterProtoFile(String fileName) Unregisters a file.voidunregisterProtoFiles(Set<String> fileNames) Unregisters a set of files.
-
Field Details
-
EMPTY_CLASSES
-
log
-
descriptorLock
All descriptor related mutable internal state is protected by this RW lock. -
configuration
-
parser
-
fileDescriptors
-
typeIds
-
genericDescriptors
-
enumValueDescriptors
-
manifestLock
All marshaller related mutable internal state is protected by this RW lock. -
marshallersByName
-
marshallersByClass
-
legacyMarshallerProviders
-
-
Constructor Details
-
SerializationContextImpl
-
-
Method Details
-
getConfiguration
Description copied from interface:ImmutableSerializationContextGet the (immutable) configuration object that was used when creating this context.- Specified by:
getConfigurationin interfaceImmutableSerializationContext
-
getFileDescriptors
Description copied from interface:ImmutableSerializationContextObtain the currently registered file descriptors.- Specified by:
getFileDescriptorsin interfaceImmutableSerializationContext- Returns:
- an immutable copy of the internal map of descriptors
-
getGenericDescriptors
Description copied from interface:ImmutableSerializationContextObtain the currently registered type descriptors.- Specified by:
getGenericDescriptorsin interfaceImmutableSerializationContext- Returns:
- an immutable copy of the internal map of descriptors
-
registerProtoFiles
Description copied from interface:SerializationContextRegister some proto schema definition files from aFileDescriptorSource.- Specified by:
registerProtoFilesin interfaceSerializationContext- Parameters:
source-- Throws:
DescriptorParserException
-
unregisterProtoFile
Description copied from interface:SerializationContextUnregisters 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:
unregisterProtoFilein interfaceSerializationContext
-
unregisterProtoFiles
Description copied from interface:SerializationContextUnregisters 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:
unregisterProtoFilesin interfaceSerializationContext
-
unregisterFileDescriptorTypes
@GuardedBy("descriptorLock") private void unregisterFileDescriptorTypes(FileDescriptor fileDescriptor) -
getMessageDescriptor
- Specified by:
getMessageDescriptorin interfaceImmutableSerializationContext
-
getEnumDescriptor
- Specified by:
getEnumDescriptorin interfaceImmutableSerializationContext
-
registerMarshaller
Description copied from interface:SerializationContextRegister a type marshaller.- Specified by:
registerMarshallerin interfaceSerializationContext- Parameters:
marshaller- the marshaller instance
-
classForName
-
makeMarshallerDelegate
-
unregisterMarshaller
- Specified by:
unregisterMarshallerin interfaceSerializationContext
-
registerMarshallerProvider
@Deprecated public void registerMarshallerProvider(SerializationContext.MarshallerProvider marshallerProvider) Deprecated.- Specified by:
registerMarshallerProviderin interfaceSerializationContext
-
unregisterMarshallerProvider
@Deprecated public void unregisterMarshallerProvider(SerializationContext.MarshallerProvider marshallerProvider) Deprecated.- Specified by:
unregisterMarshallerProviderin interfaceSerializationContext
-
registerMarshallerProvider
public void registerMarshallerProvider(SerializationContext.InstanceMarshallerProvider<?> marshallerProvider) - Specified by:
registerMarshallerProviderin interfaceSerializationContext
-
unregisterMarshallerProvider
public void unregisterMarshallerProvider(SerializationContext.InstanceMarshallerProvider<?> marshallerProvider) - Specified by:
unregisterMarshallerProviderin interfaceSerializationContext
-
canMarshall
Description copied from interface:ImmutableSerializationContextChecks if the given type (message or enum) can be marshalled. This checks that a marshaller was registered for it.- Specified by:
canMarshallin interfaceImmutableSerializationContext- Parameters:
javaClass- the object or enum class to check- Returns:
trueif a marshaller exists,falseotherwise
-
canMarshall
Description copied from interface:ImmutableSerializationContextChecks 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:
canMarshallin interfaceImmutableSerializationContext- Parameters:
fullTypeName- the fully qualified name of the Protobuf definition to check- Returns:
trueif a marshaller exists,falseotherwise
-
canMarshall
Description copied from interface:ImmutableSerializationContextChecks if the given instance can be marshalled.- Specified by:
canMarshallin interfaceImmutableSerializationContext- Parameters:
object- the instance- Returns:
trueif a marshaller exists,falseotherwise
-
getMarshaller
Description copied from interface:ImmutableSerializationContextObtains the marshaller associated with a given instance.- Specified by:
getMarshallerin interfaceImmutableSerializationContext- Parameters:
object- the instance- Returns:
- the marshaller
-
getMarshaller
Description copied from interface:ImmutableSerializationContextObtains the marshaller associated with a Protobuf type name.- Specified by:
getMarshallerin interfaceImmutableSerializationContext- Parameters:
fullTypeName- the type name- Returns:
- the marshaller
-
getMarshaller
Description copied from interface:ImmutableSerializationContextObtains the marshaller associated with a Java type.- Specified by:
getMarshallerin interfaceImmutableSerializationContext- Parameters:
clazz- the class- Returns:
- the marshaller
-
getMarshallerDelegate
-
getMarshallerDelegate
-
getMarshallerDelegate
-
getMarshallerFromLegacyProvider
@GuardedBy("manifestLock") private <T> BaseMarshaller<T> getMarshallerFromLegacyProvider(Class<T> javaClass) -
getMarshallerFromLegacyProvider
@GuardedBy("manifestLock") private <T> BaseMarshaller<T> getMarshallerFromLegacyProvider(String fullTypeName) -
getTypeNameById
Deprecated.Description copied from interface:ImmutableSerializationContextObtains the Protobuf type name associated with a numeric type id.- Specified by:
getTypeNameByIdin interfaceImmutableSerializationContext- Parameters:
typeId- the numeric type id- Returns:
- the fully qualified type name
-
getTypeIdByName
Deprecated.Description copied from interface:ImmutableSerializationContextObtains the associated numeric type id for a Protobuf type name, if a numeric id was defined.- Specified by:
getTypeIdByNamein interfaceImmutableSerializationContext- Parameters:
fullTypeName- the fully qualified type name- Returns:
- the type id or
nullif no type id is associated with the type
-
getDescriptorByName
Description copied from interface:ImmutableSerializationContextObtains the descriptor associated with a type name.- Specified by:
getDescriptorByNamein interfaceImmutableSerializationContext- Parameters:
fullTypeName- the fully qualified type name- Returns:
- the descriptor
-
getDescriptorByTypeId
Description copied from interface:ImmutableSerializationContextObtains the descriptor associated with a numeric type id.- Specified by:
getDescriptorByTypeIdin interfaceImmutableSerializationContext- Parameters:
typeId- the numeric type id- Returns:
- the descriptor
-