public class DefaultStringKeySerializer extends Object implements ObjectSerializer
The default key serializer used by caches that require serializing the keys as strings. Builds a key from the
 configured cache name and String conversion of the object as dictated by ConversionService.
Note this implementation does not support deserialization
JDK| Constructor and Description | 
|---|
| DefaultStringKeySerializer(String cacheName,
                          Charset charset,
                          ConversionService<?> conversionService)Construct a default serializer for given parameters. | 
| Modifier and Type | Method and Description | 
|---|---|
| <T> Optional<T> | deserialize(InputStream inputStream,
           Class<T> requiredType)Deserialize the given object to bytes. | 
| Optional<byte[]> | serialize(Object object)Serialize the given object to a byte[]. | 
| void | serialize(Object object,
         OutputStream outputStream)Serialize the given object to a byte[]. | 
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitdeserialize, deserializepublic DefaultStringKeySerializer(String cacheName, Charset charset, ConversionService<?> conversionService)
cacheName - The cache key or namecharset - The charset used for serialization and de-serializing instance from the to/from cacheconversionService - To convert value/object from the cache to Stringpublic Optional<byte[]> serialize(Object object) throws SerializationException
ObjectSerializerserialize in interface ObjectSerializerobject - The object to serializeSerializationException - if there is a serialization problempublic void serialize(Object object, OutputStream outputStream) throws SerializationException
ObjectSerializerserialize in interface ObjectSerializerobject - The object to serializeoutputStream - The output streamSerializationException - if there is a serialization problempublic <T> Optional<T> deserialize(InputStream inputStream, Class<T> requiredType) throws SerializationException
ObjectSerializerdeserialize in interface ObjectSerializerT - The required generic typeinputStream - The input streamrequiredType - The required typeOptional of the objectSerializationException - if there is a serialization problem