Interface ElasticsearchFieldCodec<F>
-
- All Known Implementing Classes:
AbstractElasticsearchJavaTimeFieldCodec,ElasticsearchBigDecimalFieldCodec,ElasticsearchBigIntegerFieldCodec,ElasticsearchBooleanFieldCodec,ElasticsearchByteFieldCodec,ElasticsearchDoubleFieldCodec,ElasticsearchFloatFieldCodec,ElasticsearchGeoPointFieldCodec,ElasticsearchInstantFieldCodec,ElasticsearchIntegerFieldCodec,ElasticsearchJsonElementFieldCodec,ElasticsearchLocalDateFieldCodec,ElasticsearchLocalDateTimeFieldCodec,ElasticsearchLocalTimeFieldCodec,ElasticsearchLongFieldCodec,ElasticsearchMonthDayFieldCodec,ElasticsearchOffsetDateTimeFieldCodec,ElasticsearchOffsetTimeFieldCodec,ElasticsearchShortFieldCodec,ElasticsearchStringFieldCodec,ElasticsearchYearFieldCodec,ElasticsearchYearMonthFieldCodec,ElasticsearchZonedDateTimeFieldCodec
public interface ElasticsearchFieldCodec<F>Defines how a given value will be encoded as JSON and decoded from JSON.Encodes values received from an
IndexFieldReferencewhen indexing, and returns decoded values to theElasticsearchSearchProjectionwhen projecting in a search query.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description Fdecode(com.google.gson.JsonElement element)default FdecodeAggregationKey(com.google.gson.JsonElement key, com.google.gson.JsonElement keyAsString)Decodes the key returned by a term aggregation.com.google.gson.JsonElementencode(F value)default com.google.gson.JsonElementencodeForAggregation(ElasticsearchSearchSyntax searchSyntax, F value)Encodes a value for inclusion in an aggregation request.default com.google.gson.JsonElementencodeForMissing(F value)booleanisCompatibleWith(ElasticsearchFieldCodec<?> other)Determine whether another codec is compatible with this one, i.e.
-
-
-
Method Detail
-
encode
com.google.gson.JsonElement encode(F value)
-
encodeForMissing
default com.google.gson.JsonElement encodeForMissing(F value)
-
encodeForAggregation
default com.google.gson.JsonElement encodeForAggregation(ElasticsearchSearchSyntax searchSyntax, F value)
Encodes a value for inclusion in an aggregation request.- Parameters:
searchSyntax- The search syntax.value- The value to encode.- Returns:
- The encoded value.
-
decode
F decode(com.google.gson.JsonElement element)
-
decodeAggregationKey
default F decodeAggregationKey(com.google.gson.JsonElement key, com.google.gson.JsonElement keyAsString)
Decodes the key returned by a term aggregation.- Parameters:
key- The "key" property returned by the aggregation. May be a number, a string, ... depending on the field type.keyAsString- The "key_as_string" property returned by the term aggregation. Either null or aJsonPrimitivecontaining a string.- Returns:
- The decoded term.
-
isCompatibleWith
boolean isCompatibleWith(ElasticsearchFieldCodec<?> other)
Determine whether another codec is compatible with this one, i.e. whether it will encode/decode the information to/from the document in a compatible way.- Parameters:
other- AnotherElasticsearchFieldCodec, nevernull.- Returns:
trueif the given codec is compatible.falseotherwise, or when in doubt.
-
-