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 descriptorFullName)
Checks if the given type (message or enum) can be marshalled.
|
Configuration |
getConfiguration() |
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 descriptorFullName) |
<T> BaseMarshallerDelegate<T> |
getMarshallerDelegate(Class<T> clazz) |
<T> BaseMarshallerDelegate<T> |
getMarshallerDelegate(String descriptorFullName) |
Descriptor |
getMessageDescriptor(String fullName) |
Integer |
getTypeIdByName(String descriptorFullName)
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) |
void |
unregisterProtoFile(String fileName)
Unregisters a file.
|
public SerializationContextImpl(Configuration configuration)
public Configuration getConfiguration()
getConfiguration
in interface SerializationContext
public Map<String,FileDescriptor> getFileDescriptors()
SerializationContext
getFileDescriptors
in interface SerializationContext
public void registerProtoFiles(FileDescriptorSource source) throws IOException, DescriptorParserException
registerProtoFiles
in interface SerializationContext
IOException
DescriptorParserException
public void unregisterProtoFile(String fileName)
SerializationContext
unregisterProtoFile
in interface SerializationContext
public Descriptor getMessageDescriptor(String fullName)
getMessageDescriptor
in interface SerializationContext
public EnumDescriptor getEnumDescriptor(String fullName)
getEnumDescriptor
in interface SerializationContext
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)
SerializationContext
canMarshall
in interface SerializationContext
clazz
- the object or enum class to checktrue
if a marshaller exists, false
otherwisepublic boolean canMarshall(String descriptorFullName)
SerializationContext
canMarshall
in interface SerializationContext
descriptorFullName
- the fully qualified name of the protobuf definition to checktrue
if a marshaller exists, false
otherwisepublic <T> BaseMarshaller<T> getMarshaller(String descriptorFullName)
getMarshaller
in interface SerializationContext
public <T> BaseMarshaller<T> getMarshaller(Class<T> clazz)
getMarshaller
in interface SerializationContext
public <T> BaseMarshallerDelegate<T> getMarshallerDelegate(String descriptorFullName)
public <T> BaseMarshallerDelegate<T> getMarshallerDelegate(Class<T> clazz)
public String getTypeNameById(Integer typeId)
SerializationContext
getTypeNameById
in interface SerializationContext
typeId
- the numeric type idpublic GenericDescriptor getDescriptorByName(String fullName)
getDescriptorByName
in interface SerializationContext
public GenericDescriptor getDescriptorByTypeId(Integer typeId)
SerializationContext
getDescriptorByTypeId
in interface SerializationContext
typeId
- the numeric type idpublic Integer getTypeIdByName(String descriptorFullName)
SerializationContext
getTypeIdByName
in interface SerializationContext
descriptorFullName
- the fully qualified type namenull
if no type id is associated with the typeCopyright © 2016 JBoss, a division of Red Hat. All rights reserved.