Interface Serializer<T>

Type Parameters:
T - the type of data that your serializer outputs and accepts as input

public interface Serializer<T>
A serializer is a class that is capable of turning a Tree into a specific type Serializer and back again
Trees are the primary data structure in OneConfig and are used to represent configuration data
Each node is a key-value pair of either a string and a sub-tree or a string and some data
Trees can contain arbitrary potentially complex data types in them so you need to be able to serialize and deserialize this data into a specific type
The easiest way to do this is to use the builtin ObjectSerializer which provides simple methods to convert objects into simple types along with the facility to use defined Adapters
The following types are used by this and so you need to be able to serialize and deserialize them
  • primitive type wrappers (Number and Character and Boolean)
  • CharSequence
  • Lists or Arrays of the above types (at your discretion)
  • Map containing the above types
If you do not want to use this facility you can create your own complex object serializer and use that instead
  • Method Summary

    Modifier and Type
    Method
    Description
    Return a new tree with the data in it
    serialize(@NotNull Tree config)
    Serialize the given tree into type T
  • Method Details

    • serialize

      T serialize(@NotNull @NotNull Tree config)
      Serialize the given tree into type T
      Returns:
      the serialized data
    • deserialize

      Tree deserialize(T src)
      Return a new tree with the data in it
      Parameters:
      src - the serialized data
      Returns:
      the tree created from the data