Fork me on GitHub

Object Mappper

Basic Usage

Can only create objects that have no-arg constructor, otherwise restricted to populating already existing objects

Supported Types

  • String, float, double, int, long, byte, char
  • Maps
  • Lists
  • Objects annotated with @ConfigSerializable (which are loaded from the object mapper)
  • Enum values

Other supported types may be added by registering custom TypeSerializers, explained below.

Extending

Adding custom TypeSerializers

TypeSerializers.registerSerializer(TypeSerializer) with custom implementations of TypeSerializer. Newly registered serializers are added with highest priority.

Points to extend ObjectMapper

collectFields(Map<String, FieldData> fields, Class<? super T> clazz): To control how fields that are settings are discovered from a class

constructObject(): To control how the object is created