Package co.elastic.clients.json
Class ExternallyTaggedUnion
java.lang.Object
co.elastic.clients.json.ExternallyTaggedUnion
Utilities for union types whose discriminant is not directly part of the structure, either as an enclosing property name or as
an inner property. This is used for Elasticsearch aggregation results and suggesters, using the
typed_keys
parameter that
encodes a name+type in a single JSON property.-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
ExternallyTaggedUnion.Deserializer<Union extends TaggedUnion<?,
?>, Member> A deserializer for externally-tagged unions.static class
ExternallyTaggedUnion.TypedKeysDeserializer<Union extends TaggedUnion<?,
?>> -
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends TaggedUnion<?,
?>>
JsonpDeserializer<Map<String,List<T>>> arrayMapDeserializer
(ExternallyTaggedUnion.TypedKeysDeserializer<T> deserializer) static <T extends JsonpSerializable & TaggedUnion<? extends JsonEnum,
?>>
voidserializeTypedKeys
(Map<String, T> map, jakarta.json.stream.JsonGenerator generator, JsonpMapper mapper) Serialize a map of externally tagged union objects.static <T extends JsonpSerializable & TaggedUnion<? extends JsonEnum,
?>>
voidserializeTypedKeysArray
(Map<String, List<T>> map, jakarta.json.stream.JsonGenerator generator, JsonpMapper mapper) Serialize a map of externally tagged union object arrays.static <T extends JsonpSerializable & TaggedUnion<? extends JsonEnum,
?>>
voidserializeTypedKeysInner
(Map<String, T> map, jakarta.json.stream.JsonGenerator generator, JsonpMapper mapper) Serialize a map of externally tagged union objects, without the enclosing start/end object.
-
Method Details
-
arrayMapDeserializer
public static <T extends TaggedUnion<?,?>> JsonpDeserializer<Map<String,List<T>>> arrayMapDeserializer(ExternallyTaggedUnion.TypedKeysDeserializer<T> deserializer) -
serializeTypedKeys
public static <T extends JsonpSerializable & TaggedUnion<? extends JsonEnum,?>> void serializeTypedKeys(Map<String, T> map, jakarta.json.stream.JsonGenerator generator, JsonpMapper mapper) Serialize a map of externally tagged union objects.If
JsonpMapperFeatures.SERIALIZE_TYPED_KEYS
istrue
(the default), the typed keys encoding (type#name
) is used. -
serializeTypedKeysArray
public static <T extends JsonpSerializable & TaggedUnion<? extends JsonEnum,?>> void serializeTypedKeysArray(Map<String, List<T>> map, jakarta.json.stream.JsonGenerator generator, JsonpMapper mapper) Serialize a map of externally tagged union object arrays.If
JsonpMapperFeatures.SERIALIZE_TYPED_KEYS
istrue
(the default), the typed keys encoding (type#name
) is used. -
serializeTypedKeysInner
public static <T extends JsonpSerializable & TaggedUnion<? extends JsonEnum,?>> void serializeTypedKeysInner(Map<String, T> map, jakarta.json.stream.JsonGenerator generator, JsonpMapper mapper) Serialize a map of externally tagged union objects, without the enclosing start/end object.If
JsonpMapperFeatures.SERIALIZE_TYPED_KEYS
istrue
(the default), the typed keys encoding (type#name
) is used.
-