Skip to content
Connor (Vectrix) edited this page May 15, 2017 · 15 revisions

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
  • URIs
  • URLs
  • 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.getDefaultSerializers().registerType(TypeToken, 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

Clone this wiki locally