Class AbstractElasticsearchJavaTimeFieldCodec<T extends TemporalAccessor>
java.lang.Object
org.hibernate.search.backend.elasticsearch.types.codec.impl.AbstractElasticsearchFieldCodec<T>
org.hibernate.search.backend.elasticsearch.types.codec.impl.AbstractElasticsearchJavaTimeFieldCodec<T>
- All Implemented Interfaces:
ElasticsearchFieldCodec<T>
- Direct Known Subclasses:
ElasticsearchInstantFieldCodec,ElasticsearchLocalDateFieldCodec,ElasticsearchLocalDateTimeFieldCodec,ElasticsearchLocalTimeFieldCodec,ElasticsearchMonthDayFieldCodec,ElasticsearchOffsetDateTimeFieldCodec,ElasticsearchOffsetTimeFieldCodec,ElasticsearchYearFieldCodec,ElasticsearchYearMonthFieldCodec,ElasticsearchZonedDateTimeFieldCodec
public abstract class AbstractElasticsearchJavaTimeFieldCodec<T extends TemporalAccessor>
extends AbstractElasticsearchFieldCodec<T>
-
Field Summary
FieldsFields inherited from class org.hibernate.search.backend.elasticsearch.types.codec.impl.AbstractElasticsearchFieldCodec
gson -
Constructor Summary
ConstructorsConstructorDescriptionAbstractElasticsearchJavaTimeFieldCodec(com.google.gson.Gson gson, DateTimeFormatter delegate) -
Method Summary
Modifier and TypeMethodDescriptiondecode(com.google.gson.JsonElement element) decodeAggregationKey(com.google.gson.JsonElement key, com.google.gson.JsonElement keyAsString) Decodes the key returned by a term aggregation.com.google.gson.JsonElementcom.google.gson.JsonElementencodeForMissing(T value) A different encoding is required for provided missing Java time values.booleanDetermine 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.protected StringnullUnsafeFormat(T value) protected abstract TnullUnsafeParse(String stringValue) protected abstract LongnullUnsafeScalar(T value) Methods inherited from class org.hibernate.search.backend.elasticsearch.types.codec.impl.AbstractElasticsearchFieldCodec
fromJsonElementToString, fromJsonStringToElementMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.hibernate.search.backend.elasticsearch.types.codec.impl.ElasticsearchFieldCodec
canDecodeArrays, encodeForAggregation
-
Field Details
-
formatter
-
-
Constructor Details
-
AbstractElasticsearchJavaTimeFieldCodec
public AbstractElasticsearchJavaTimeFieldCodec(com.google.gson.Gson gson, DateTimeFormatter delegate)
-
-
Method Details
-
encode
-
encodeForMissing
A different encoding is required for provided missing Java time values. See HSEARCH-3255.- Parameters:
value- to encode- Returns:
- a
JsonElementcontaining the long scalar value, ifvalueis not null.
-
decode
-
decodeAggregationKey
public T decodeAggregationKey(com.google.gson.JsonElement key, com.google.gson.JsonElement keyAsString) Description copied from interface:ElasticsearchFieldCodecDecodes 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
Description copied from interface:ElasticsearchFieldCodecDetermine 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:
obj- AnotherElasticsearchFieldCodec, nevernull.- Returns:
trueif the given codec is compatible.falseotherwise, or when in doubt.
-
nullUnsafeFormat
-
nullUnsafeParse
-
nullUnsafeScalar
-