Interface StringObjectValidator<T>

  • Type Parameters:
    T - The type of the payload. The Fernet token encodes the payload in binary. The type T should be a domain object or data transfer object representation of that data.
    All Superinterfaces:
    Validator<T>

    public interface StringObjectValidator<T>
    extends Validator<T>
    A Validator for payloads that represent objects as Strings (e.g. JSON or XML). This validator converts the payload to a String then delegates to getStringTransformer() to convert that String to an object. If the deserialisation library you use already provides a way to convert binary into objects, then you can use Validator directly instead.

    Copyright © 2017 Carlos Macasaet.

    Author:
    Carlos Macasaet
    • Method Detail

      • getCharset

        default Charset getCharset()
      • getStringCreator

        default Function<byte[],​String> getStringCreator()
        Override this to specify an alternative way to convert binary data into a String. The default implementation uses the UTF-8 character set.
        Returns:
        a method for converting a byte array into a String
      • getTransformer

        default Function<byte[],​T> getTransformer()
        Description copied from interface: Validator
        Implement this to define how decrypted content is deserialised into domain objects.
        Specified by:
        getTransformer in interface Validator<T>
        Returns:
        a method for converting the decrypted payload into a domain object
      • getStringTransformer

        Function<String,​T> getStringTransformer()
        Plug in your String deserialisation method here.
        Returns:
        a method for converting a String into an Object.