Record Class Codec.OneOfCodec<T>
java.lang.Object
java.lang.Record
com.github.darksoulq.abyssallib.common.serialization.Codec.OneOfCodec<T>
- Type Parameters:
T- The common type returned by all provided codecs.- Record Components:
codecs- The list of candidate codecs.
- All Implemented Interfaces:
Codec<T>
-
Nested Class Summary
Nested classes/interfaces inherited from interface Codec
Codec.CodecException, Codec.EitherCodec<A,B>, Codec.Field<P, T>, Codec.OneOfCodec<T> -
Constructor Summary
ConstructorsConstructorDescriptionOneOfCodec(List<Codec<T>> codecs) Constructs a oneOf codec with an immutable copy of the provided list. -
Method Summary
Modifier and TypeMethodDescriptioncodecs()Returns the value of thecodecsrecord component.<D> Tdecode(DynamicOps<D> ops, D input) Decodes the input using the first codec in the list that succeeds.<D> Dencode(DynamicOps<D> ops, T value) Encodes the value using the first codec in the list that succeeds.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
OneOfCodec
-
-
Method Details
-
decode
Decodes the input using the first codec in the list that succeeds. -
encode
Encodes the value using the first codec in the list that succeeds. -
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
codecs
-