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
Trees are the primary data structure in OneConfig, and are used to represent configuration data. They are a tree structure, with each node being 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. 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
Tree into a specific type Serializer, and vice versa.
Trees are the primary data structure in OneConfig, and are used to represent configuration data. They are a tree structure, with each node being 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. 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, Character, Boolean)
- CharSequence
- Lists or Arrays of the above types (at your discretion)
- Map (containing the above types).
-
Method Summary
-
Method Details
-
serialize
Serialize the given tree into type T.- Returns:
- the serialized data
-
deserialize
Return a new tree with the data in it.- Parameters:
src- the serialized data- Returns:
- the tree created from the data
-