Interface Decomposer


public interface Decomposer
A complement to FlexibleType which allows objects to be broken down during reserialisation.

Note that, unlike a FlexibleType, a decomposer does not store any value paired with it.
Author:
A248
  • Method Details

    • decomposeCollection

      <E> Collection<Object> decomposeCollection(Class<E> elementType, Collection<? extends E> collection)
      Decomposes all the elements of a collection. Equivalent to calling decompose(Class, Object) to process each element.

      The returned collection may or may not be mutable. The caller should create a copy if modification is desired.
      Type Parameters:
      E - the element type
      Parameters:
      elementType - the element type class
      collection - the collection to decompose
      Returns:
      the serialised form of the object
    • decomposeMap

      <K, V> Map<Object,Object> decomposeMap(Class<K> keyType, Class<V> valueType, Map<? extends K,? extends V> map)
      Decomposes all the keys and values of a map. Equivalent to calling decompose(Class, Object) to process each key and value.

      The returned map may or may not be mutable. The caller should create a copy if modification is desired.
      Type Parameters:
      K - the key type
      V - the value type
      Parameters:
      keyType - the key type class
      valueType - the value type class
      map - the map to decompose
      Returns:
      the serialised form of the object
    • decompose

      <T> Object decompose(Class<T> type, T value)
      Decomposes an object of a certain type, using a value serializer if necessary.

      If the type in question is not a String, primitive, or enum, then the appropriate value serializer is used. If no value serializer for type exists, IllDefinedConfigException is thrown.
      Type Parameters:
      T - the type according to which to serialise
      Parameters:
      type - the type of the object according to which to serialise
      value - the object to serialise
      Returns:
      the serialised form of the object
      Throws:
      IllDefinedConfigException - if no value serializer could be found for the type