Interface Transformer


  • public interface Transformer
    Convert objects (cache keys only) from their original Java types to a String representation (which is suitable to be used in a Lucene index) and vice versa. Transformers are needed only for custom types. Primitive types (boxed), java.lang.String, java.util.UUID and byte arrays are internally handled without the need of a user-supplied Transformer.

    Implementations must be thread-safe! It is recommended they are also stateless.

    Since:
    4.0
    Author:
    Manik Surtani
    • Method Detail

      • fromString

        Object fromString​(String str)
        Transforms a String into an Object.
        Parameters:
        str - cannot be null
        Returns:
        the Object that is encoded in the given String
      • toString

        String toString​(Object obj)
        Transforms an Object into a String.
        Parameters:
        obj - cannot be null
        Returns:
        the String representation of the object