- Type Parameters:
T- The concrete type.
public interface ESExprCodec<T>
Encodes and Decodes ESExpr values into concrete types.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceThe path of a decode failure. -
Method Summary
Modifier and TypeMethodDescriptionstatic ESExprCodec<BigInteger> A codec for BigInteger values.static ESExprCodec<Boolean> A codec for Boolean values.static ESExprCodec<byte[]> A codec for byte array values.default TDecode an ESExpr into a value.decode(ESExpr expr, ESExprCodec.FailurePath path) Decode an ESExpr into a value.static ESExprCodec<Double> A codec for Double values.Encode a value into an ESExpr.static ESExprCodec<Float> A codec for Float values.static ESExprCodec<org.eclipse.collections.api.list.primitive.ImmutableByteList> A codec for ImmutableByteList values.static ESExprCodec<org.eclipse.collections.api.list.primitive.ImmutableIntList> A codec for ImmutableIntList values.static ESExprCodec<org.eclipse.collections.api.list.primitive.ImmutableLongList> A codec for ImmutableLongList values.static <K,V> ESExprCodec <com.google.common.collect.ImmutableMap<K, V>> immutableMapCodec(ESExprCodec<K> keyCodec, ESExprCodec<V> valueCodec) Creates anESExprCodecfor encoding and decoding immutable maps.static <T> ESExprCodec<com.google.common.collect.ImmutableSet<T>> immutableSetCodec(ESExprCodec<T> elementCodec) Creates anESExprCodecfor encoding and decoding immutable sets.static ESExprCodec<org.eclipse.collections.api.list.primitive.ImmutableShortList> A codec for ImmutableShortList values.static ESExprCodec<int[]> A codec for int array values.booleanisEncodedEqual(T x, T y) Determines whether two values are equal when encoded as an `ESExpr`.static <T> ESExprCodec<List<T>> listCodec(ESExprCodec<T> itemCodec) A codec for list values.static ESExprCodec<long[]> A codec for long array values.static <K,V> ESExprCodec <Map<K, V>> mapCodec(ESExprCodec<K> keyCodec, ESExprCodec<V> valueCodec) Creates anESExprCodecfor encoding and decoding maps.static <T> ESExprCodec<Optional<T>> optionalCodec(ESExprCodec<T> itemCodec) A codec for optional values.static <T> ESExprCodec<Set<T>> setCodec(ESExprCodec<T> elementCodec) Creates anESExprCodecfor encoding and decoding sets of elements.static ESExprCodec<short[]> A codec for short array values.static ESExprCodec<Byte> A codec for signed Byte values.static ESExprCodec<Integer> A codec for signed Integer values.static ESExprCodec<Long> A codec for signed Long values.static ESExprCodec<Short> A codec for signed Short values.static ESExprCodec<String> A codec for String values.tags()Gets the set of tags of values for this type.static ESExprCodec<com.google.common.primitives.UnsignedInteger> A codec for unsigned Integer values.static ESExprCodec<com.google.common.primitives.UnsignedLong> A codec for unsigned Long values.
-
Method Details
-
tags
-
encode
-
decode
Decode an ESExpr into a value.- Parameters:
expr- The ESExpr to decode.- Returns:
- The decoded value.
- Throws:
DecodeException- when the value cannot be decoded.
-
decode
Decode an ESExpr into a value.- Parameters:
expr- The ESExpr to decode.path- The path of the current value within the decoded object for diagnostic purposes.- Returns:
- The decoded value.
- Throws:
DecodeException- when the value cannot be decoded.
-
isEncodedEqual
-
optionalCodec
A codec for optional values.- Type Parameters:
T- The type of the optional value.- Parameters:
itemCodec- The underlying codec for the values.- Returns:
- The codec.
-
listCodec
A codec for list values.- Type Parameters:
T- The type of the list elements.- Parameters:
itemCodec- The underlying codec for the values.- Returns:
- The codec.
-
booleanCodec
-
stringCodec
-
floatCodec
-
doubleCodec
-
signedIntegerCodec
A codec for signed Integer values.- Returns:
- The codec.
-
signedLongCodec
-
signedShortCodec
-
signedByteCodec
-
unsignedIntegerCodec
A codec for unsigned Integer values.- Returns:
- The codec.
-
unsignedLongCodec
A codec for unsigned Long values.- Returns:
- The codec.
-
bigIntegerCodec
-
byteArrayCodec
-
shortArrayCodec
-
intArrayCodec
-
longArrayCodec
-
immutableByteListCodec
static ESExprCodec<org.eclipse.collections.api.list.primitive.ImmutableByteList> immutableByteListCodec()A codec for ImmutableByteList values.- Returns:
- The codec.
-
immutableShortListCodec
static ESExprCodec<org.eclipse.collections.api.list.primitive.ImmutableShortList> immutableShortListCodec()A codec for ImmutableShortList values.- Returns:
- The codec.
-
immutableIntListCodec
static ESExprCodec<org.eclipse.collections.api.list.primitive.ImmutableIntList> immutableIntListCodec()A codec for ImmutableIntList values.- Returns:
- The codec.
-
immutableLongListCodec
static ESExprCodec<org.eclipse.collections.api.list.primitive.ImmutableLongList> immutableLongListCodec()A codec for ImmutableLongList values.- Returns:
- The codec.
-
mapCodec
Creates anESExprCodecfor encoding and decoding maps.- Type Parameters:
K- The type of the keys in the map.V- The type of the values in the map.- Parameters:
keyCodec- The codec used for encoding and decoding the keys in the map.valueCodec- The codec used for encoding and decoding the values in the map.- Returns:
- An
ESExprCodecinstance configured to handle maps with the specified key and value types.
-
immutableMapCodec
static <K,V> ESExprCodec<com.google.common.collect.ImmutableMap<K,V>> immutableMapCodec(ESExprCodec<K> keyCodec, ESExprCodec<V> valueCodec) Creates anESExprCodecfor encoding and decoding immutable maps.- Type Parameters:
K- The type of the keys in the map.V- The type of the values in the map.- Parameters:
keyCodec- The codec used for encoding and decoding the keys in the map.valueCodec- The codec used for encoding and decoding the values in the map.- Returns:
- An
ESExprCodecinstance configured to handle immutable maps with the specified key and value types.
-
setCodec
Creates anESExprCodecfor encoding and decoding sets of elements.- Type Parameters:
T- The type of elements contained in the set.- Parameters:
elementCodec- The codec used for encoding and decoding individual elements within the set.- Returns:
- An
ESExprCodecinstance configured to handle sets of the specified element type.
-
immutableSetCodec
static <T> ESExprCodec<com.google.common.collect.ImmutableSet<T>> immutableSetCodec(ESExprCodec<T> elementCodec) Creates anESExprCodecfor encoding and decoding immutable sets.- Type Parameters:
T- The type of the elements in the set.- Parameters:
elementCodec- The codec used for encoding and decoding the individual elements of the set.- Returns:
- An
ESExprCodecinstance configured to handle immutable sets of the specified element type.
-