Class Codecs


  • public class Codecs
    extends Object
    Codecs is a container for accessing default Codec implementations.
    Since:
    3.7.1
    Author:
    hr
    • Constructor Detail

      • Codecs

        public Codecs()
    • Method Detail

      • getCodec

        public static Codec getCodec​(Class<?> clz)
        Return a Codec based on the provided Class.

        The provided Class should implement one of:

        1. Codec - the Codec implementation should have a no-arg constructor which will be instantiated and returned.
        2. Collection - the provided class should implement the Collection interface and have a no-arg constructor. A Codec supporting Collections will be returned
        3. Map - the provided class should implement the Map interface and have a no-arg constructor. A Codec supporting Maps will be returned
        4. LongArray - the provided class should implement the LongArray interface and have a no-arg constructor. A Codec supporting LongArrays will be returned
        5. T[] - the provided class should be an array and the component type of the array should have a no-arg constructor. A Codec supporting arrays will be returned
        Parameters:
        clz - a Class that implements Codec or is one of the supported types
        Returns:
        a Codec that supports encoding and decoding of objects of the specified type