java.lang.Object
dev.argon.esexpr.ESExprCodec<T>
- Type Parameters:
T- The concrete type.
- Direct Known Subclasses:
BigIntegerCodec,BooleanCodec,ByteArrayCodec,DoubleCodec,FloatCodec,ImmutableByteListCodec,ImmutableIntListCodec,ImmutableLongListCodec,ImmutableShortListCodec,IntArrayCodec,IntCodecBase,ListCodec,LongArrayCodec,NonNegativeBigIntegerCodec,OptionalCodec,ShortArrayCodec,StringCodec
Encodes and Decodes ESExpr values into concrete types.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceThe path of a decode failure. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal TDecode an ESExpr into a value.abstract Tdecode(ESExpr expr, ESExprCodec.FailurePath path) Decode an ESExpr into a value.abstract ESExprEncode a value into an ESExpr.abstract booleanisEncodedEqual(T x, T y) Determines whether two values are equal when encoded as an `ESExpr`.static <T> ESExprCodec<Optional<T>> optionalCodec(ESExprCodec<T> itemCodec) A codec for optional values.abstract ESExprTagSettags()Gets the set of tags of values for this type.
-
Constructor Details
-
ESExprCodec
public ESExprCodec()Creates a codec.
-
-
Method Details
-
tags
Gets the set of tags of values for this type.- Returns:
- The set of 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.
-