public final class SerializationContextImpl extends Object implements SerializationContext
Constructor and Description |
---|
SerializationContextImpl(Configuration configuration) |
Modifier and Type | Method and Description |
---|---|
boolean |
canMarshall(Class<?> clazz)
Checks if the given type (message or enum) can be marshalled.
|
boolean |
canMarshall(String fullName)
Checks if the given type (message or enum) can be marshalled.
|
Configuration |
getConfiguration()
Get the configuration.
|
GenericDescriptor |
getDescriptorByName(String fullName) |
GenericDescriptor |
getDescriptorByTypeId(Integer typeId)
Obtains the type name associated with a numeric type id.
|
EnumDescriptor |
getEnumDescriptor(String fullName) |
Map<String,FileDescriptor> |
getFileDescriptors()
Obtain the registered file descriptors.
|
<T> BaseMarshaller<T> |
getMarshaller(Class<T> clazz) |
<T> BaseMarshaller<T> |
getMarshaller(String fullName) |
<T> BaseMarshallerDelegate<T> |
getMarshallerDelegate(Class<T> clazz) |
<T> BaseMarshallerDelegate<T> |
getMarshallerDelegate(String descriptorFullName) |
Descriptor |
getMessageDescriptor(String fullName) |
Integer |
getTypeIdByName(String fullName)
Obtains the associated numeric type id, if one was defined.
|
String |
getTypeNameById(Integer typeId)
Obtains the type name associated with a numeric type id.
|
<T> void |
registerMarshaller(BaseMarshaller<T> marshaller)
Register a type marshaller.
|
void |
registerProtoFiles(FileDescriptorSource source)
Register some proto schema definition files from a
FileDescriptorSource . |
void |
unregisterProtoFile(String fileName)
Unregisters a file.
|
public SerializationContextImpl(Configuration configuration)
public Configuration getConfiguration()
SerializationContext
getConfiguration
in interface SerializationContext
public Map<String,FileDescriptor> getFileDescriptors()
ImmutableSerializationContext
getFileDescriptors
in interface ImmutableSerializationContext
public void registerProtoFiles(FileDescriptorSource source) throws IOException, DescriptorParserException
SerializationContext
FileDescriptorSource
.registerProtoFiles
in interface SerializationContext
IOException
DescriptorParserException
public void unregisterProtoFile(String fileName)
SerializationContext
unregisterProtoFile
in interface SerializationContext
public Descriptor getMessageDescriptor(String fullName)
getMessageDescriptor
in interface ImmutableSerializationContext
public EnumDescriptor getEnumDescriptor(String fullName)
getEnumDescriptor
in interface ImmutableSerializationContext
public <T> void registerMarshaller(BaseMarshaller<T> marshaller)
SerializationContext
registerMarshaller
in interface SerializationContext
T
- the Java type of the object being handled by the marshallermarshaller
- the marshaller instancepublic boolean canMarshall(Class<?> clazz)
ImmutableSerializationContext
canMarshall
in interface ImmutableSerializationContext
clazz
- the object or enum class to checktrue
if a marshaller exists, false
otherwisepublic boolean canMarshall(String fullName)
ImmutableSerializationContext
canMarshall
in interface ImmutableSerializationContext
fullName
- the fully qualified name of the protobuf definition to checktrue
if a marshaller exists, false
otherwisepublic <T> BaseMarshaller<T> getMarshaller(String fullName)
getMarshaller
in interface ImmutableSerializationContext
public <T> BaseMarshaller<T> getMarshaller(Class<T> clazz)
getMarshaller
in interface ImmutableSerializationContext
public <T> BaseMarshallerDelegate<T> getMarshallerDelegate(String descriptorFullName)
public <T> BaseMarshallerDelegate<T> getMarshallerDelegate(Class<T> clazz)
public String getTypeNameById(Integer typeId)
ImmutableSerializationContext
getTypeNameById
in interface ImmutableSerializationContext
typeId
- the numeric type idpublic GenericDescriptor getDescriptorByName(String fullName)
getDescriptorByName
in interface ImmutableSerializationContext
public GenericDescriptor getDescriptorByTypeId(Integer typeId)
ImmutableSerializationContext
getDescriptorByTypeId
in interface ImmutableSerializationContext
typeId
- the numeric type idpublic Integer getTypeIdByName(String fullName)
ImmutableSerializationContext
getTypeIdByName
in interface ImmutableSerializationContext
fullName
- the fully qualified type namenull
if no type id is associated with the typeCopyright © 2017 JBoss, a division of Red Hat. All rights reserved.