Members

class Members<T>

Callback used to configure JSON members. Individual members can be declared using the various add(...) methods. Typically, members are declared with a "name" and a Function that will extract the value from the instance. Members can also be declared using a static value or a Supplier. The add and add methods may be used to access the actual instance being written.

Members can be added without a name when a Member.using(...) method is used to complete the definition.

Members can filtered using Member.when methods and adapted to different types using Member.as(...).

Parameters

<T>

the type that will be written

Functions

Link copied to clipboard
open fun add(): JsonWriter.Member<T>
open fun add(name: String): JsonWriter.Member<T>
Add a new member with access to the instance being written.
open fun <V> add(name: String, value: V): JsonWriter.Member<V>
Add a new member with a static value.
open fun <V> add(name: String, extractor: (T) -> V): JsonWriter.Member<V>
Add a new member with an extracted value.
open fun <V> add(name: String, supplier: Supplier<V>): JsonWriter.Member<V>
Add a new member with a supplied value.
Link copied to clipboard
open fun <M : Map<K, V>?, K, V> addMapEntries(extractor: (T) -> M): JsonWriter.Member<M>
Add all entries from the given Map to the JSON.
Link copied to clipboard
Add the a NameProcessor to be applied when the JSON is written.
Link copied to clipboard
Add a filter that will be used to restrict the members written to the JSON.
Link copied to clipboard
Add the a ValueProcessor to be applied when the JSON is written.
Link copied to clipboard
open fun <V> from(value: V): JsonWriter.Member<V>
Add members from a static value.
open fun <V> from(extractor: (T) -> V): JsonWriter.Member<V>
Add members from an extracted value.
open fun <V> from(supplier: Supplier<V>): JsonWriter.Member<V>
Add members from a supplied value.