类 JsonWriter.Members<T>
java.lang.Object
org.springframework.boot.json.JsonWriter.Members<T>
- 类型参数:
T- the type that will be written
- 封闭接口:
JsonWriter<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(String) 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(...).
-
方法概要
修饰符和类型方法说明add()Add a new member with access to the instance being written.Add a new member with access to the instance being written.<V> JsonWriter.Member<V> Add a new member with an extracted value.<V> JsonWriter.Member<V> Add a new member with a supplied value.<V> JsonWriter.Member<V> Add a new member with a static value.<M extends Map<K,V>, K, V>
JsonWriter.Member<M> addMapEntries(Function<T, M> extractor) Add all entries from the givenMapto the JSON.voidapplyingNameProcessor(JsonWriter.NameProcessor nameProcessor) Add the aJsonWriter.NameProcessorto be applied when the JSON is written.voidapplyingPathFilter(Predicate<JsonWriter.MemberPath> predicate) Add a filter that will be used to restrict the members written to the JSON.voidapplyingValueProcessor(JsonWriter.ValueProcessor<?> valueProcessor) Add the aJsonWriter.ValueProcessorto be applied when the JSON is written.<V> JsonWriter.Member<V> Add members from an extracted value.<V> JsonWriter.Member<V> Add members from a supplied value.<V> JsonWriter.Member<V> from(V value) Add members from a static value.
-
方法详细资料
-
add
Add a new member with access to the instance being written.- 参数:
name- the member name- 返回:
- the added
JsonWriter.Memberwhich may be configured further
-
add
Add a new member with a static value.- 类型参数:
V- the value type- 参数:
name- the member namevalue- the member value- 返回:
- the added
JsonWriter.Memberwhich may be configured further
-
add
Add a new member with a supplied value.- 类型参数:
V- the value type- 参数:
name- the member namesupplier- a supplier of the value- 返回:
- the added
JsonWriter.Memberwhich may be configured further
-
add
Add a new member with an extracted value.- 类型参数:
V- the value type- 参数:
name- the member nameextractor- a function to extract the value- 返回:
- the added
JsonWriter.Memberwhich may be configured further
-
add
Add a new member with access to the instance being written. The member is added without a name, so one of theMember.using(...)methods must be used to complete the configuration.- 返回:
- the added
JsonWriter.Memberwhich may be configured further
-
addMapEntries
Add all entries from the givenMapto the JSON.- 类型参数:
M- the map typeK- the key typeV- the value type- 参数:
extractor- a function to extract the map- 返回:
- the added
JsonWriter.Memberwhich may be configured further
-
from
Add members from a static value. One of theMember.using(...)methods must be used to complete the configuration.- 类型参数:
V- the value type- 参数:
value- the member value- 返回:
- the added
JsonWriter.Memberwhich may be configured further
-
from
Add members from a supplied value. One of theMember.using(...)methods must be used to complete the configuration.- 类型参数:
V- the value type- 参数:
supplier- a supplier of the value- 返回:
- the added
JsonWriter.Memberwhich may be configured further
-
from
Add members from an extracted value. One of theMember.using(...)methods must be used to complete the configuration.- 类型参数:
V- the value type- 参数:
extractor- a function to extract the value- 返回:
- the added
JsonWriter.Memberwhich may be configured further
-
applyingPathFilter
Add a filter that will be used to restrict the members written to the JSON.- 参数:
predicate- the predicate used to filter members
-
applyingNameProcessor
Add the aJsonWriter.NameProcessorto be applied when the JSON is written.- 参数:
nameProcessor- the name processor to add
-
applyingValueProcessor
Add the aJsonWriter.ValueProcessorto be applied when the JSON is written.- 参数:
valueProcessor- the value processor to add
-