Package com.carfey.ops.job.result
Interface SerializationStrategy
-
- All Known Implementing Classes:
DefaultSerializationStrategy,JsonSerializationStrategy
public interface SerializationStrategyASerializationStrategyis used to convert job results into a form that can be stored as a string and retrieved.See
SerializationFactoryand the default implementations,DefaultSerializationStrategyandJsonSerializationStrategy.- Since:
- 4.4
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <T> Tdeserialize(java.lang.Class<T> clazz, java.lang.String value)Reconstructs the object from its string representation, which was created byserialize(Object).java.lang.Stringserialize(java.lang.Object obj)Converts the object to its string representation which can be supplied todeserialize(Class, String)to reconstruct the object.booleansupports(java.lang.Class<?> clazz)Does this strategy support the specified type? Generic implementations may simply always return true.
-
-
-
Method Detail
-
supports
boolean supports(java.lang.Class<?> clazz)
Does this strategy support the specified type? Generic implementations may simply always return true.- Returns:
- whether this strategy supports serializing and deserializing the type.
-
serialize
java.lang.String serialize(java.lang.Object obj) throws java.lang.ExceptionConverts the object to its string representation which can be supplied todeserialize(Class, String)to reconstruct the object.- Parameters:
obj- (not null)- Returns:
- string representation of the object
- Throws:
java.lang.Exception- any failure to serialize
-
deserialize
<T> T deserialize(java.lang.Class<T> clazz, java.lang.String value) throws java.lang.ExceptionReconstructs the object from its string representation, which was created byserialize(Object).- Parameters:
clazz- (not null) type of objectvalue- (not null) string representation- Returns:
- the reconstructed object
- Throws:
java.lang.Exception- any failure to deserialize
-
-