@Transactional public class SerializationServiceImpl extends BaseOpenmrsService implements SerializationService
Constructor and Description |
---|
SerializationServiceImpl() |
Modifier and Type | Method and Description |
---|---|
<T> T |
deserialize(String serializedObject,
Class<? extends T> objectClass,
Class<? extends OpenmrsSerializer> serializerClass)
Deserialize the given string into a full object using the given
OpenmrsSerializer
class |
OpenmrsSerializer |
getDefaultSerializer()
Returns the default serializer configured for the system.
|
OpenmrsSerializer |
getSerializer(Class<? extends OpenmrsSerializer> serializationClass)
Returns the serializer that matches the passed class, or null if no such serializer exists.
|
List<? extends OpenmrsSerializer> |
getSerializers()
Gets the list of OpenmrsSerializers that have been registered with this service.
|
String |
serialize(Object o,
Class<? extends OpenmrsSerializer> clazz)
Serialize the passed object into an identifying string that can be retrieved later using the
passed
OpenmrsSerializer class |
static void |
setSerializerMap(Map<Class<? extends OpenmrsSerializer>,OpenmrsSerializer> serializerMap) |
void |
setSerializers(List<? extends OpenmrsSerializer> serializers) |
onShutdown, onStartup
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
onShutdown, onStartup
public OpenmrsSerializer getSerializer(Class<? extends OpenmrsSerializer> serializationClass)
SerializationService
getSerializer
in interface SerializationService
serializationClass
- - the serialization class to retrieveOpenmrsSerializer
that matches the passed class
Should return a serializer of the given classSerializationService.getSerializer(java.lang.Class)
@Transactional(readOnly=true) public OpenmrsSerializer getDefaultSerializer()
SerializationService
getDefaultSerializer
in interface SerializationService
OpenmrsSerializer
the default configured serializer
Should return a serializerSerializationService.getDefaultSerializer()
public String serialize(Object o, Class<? extends OpenmrsSerializer> clazz) throws SerializationException
SerializationService
OpenmrsSerializer
classserialize
in interface SerializationService
o
- - the object to serializeclazz
- - the OpenmrsSerializer
class to use for serializationSerializationException
SerializationService.serialize(java.lang.Object, java.lang.Class)
public <T> T deserialize(String serializedObject, Class<? extends T> objectClass, Class<? extends OpenmrsSerializer> serializerClass) throws SerializationException
SerializationService
OpenmrsSerializer
classdeserialize
in interface SerializationService
serializedObject
- - String to deserialize into an ObjectobjectClass
- - The class to deserialize the Object intoserializerClass
- - The OpenmrsSerializer
class to use to perform the
deserializationSerializationException
SerializationService.deserialize(java.lang.String, java.lang.Class,
java.lang.Class)
public List<? extends OpenmrsSerializer> getSerializers()
SerializationService
<bean parent="serializationServiceTarget"> <property name="serializers"> <list> <ref bean="xstreamSerializer"/> </list> </property> </bean> <bean id="xstreamSerializer" class="org.openmrs.module.serialization.xstream.XStreamSerializer"/>
getSerializers
in interface SerializationService
public static void setSerializerMap(Map<Class<? extends OpenmrsSerializer>,OpenmrsSerializer> serializerMap)
public void setSerializers(List<? extends OpenmrsSerializer> serializers)
serializers
- the serializers to set
Should not reset serializers list when called multiple timesCopyright © 2024 OpenMRS Inc.. All rights reserved.