Package io.permazen.encoding
Class Tuple2Encoding<V1,V2>
- All Implemented Interfaces:
Encoding<Tuple2<V1,
,V2>> NaturalSortAware
,Serializable
,Comparator<Tuple2<V1,
V2>>
Composite encoding constructed from the concatenation of two component encodings.
- See Also:
-
Field Summary
Fields inherited from class io.permazen.encoding.AbstractEncoding
encodingId, typeToken
Fields inherited from interface io.permazen.encoding.Encoding
MAX_ARRAY_DIMENSIONS
-
Constructor Summary
ConstructorDescriptionTuple2Encoding
(EncodingId encodingId, Encoding<V1> value1Encoding, Encoding<V2> value2Encoding) Constructor. -
Method Summary
Modifier and TypeMethodDescriptioncreateTuple
(Object[] values) withEncodingId
(EncodingId encodingId) Build an encoding that has the givenEncodingId
but is otherwise equivalent to this encoding.Methods inherited from class io.permazen.encoding.TupleEncoding
compare, fromString, getSize, hasPrefix0x00, hasPrefix0xff, read, skip, toString, write
Methods inherited from class io.permazen.encoding.AbstractEncoding
equals, getDefaultValueObject, getEncodingId, getTypeToken, hashCode, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Comparator
reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
Methods inherited from interface io.permazen.encoding.Encoding
convert, decode, encode, getDefaultValue, getKeyRange, sortsNaturally, supportsNull, validate, validateAndWrite
-
Constructor Details
-
Tuple2Encoding
public Tuple2Encoding(EncodingId encodingId, Encoding<V1> value1Encoding, Encoding<V2> value2Encoding) Constructor.- Parameters:
encodingId
- encoding ID, or null for an anonymous instancevalue1Encoding
- component value encodingvalue2Encoding
- component value encoding- Throws:
IllegalArgumentException
- if any component value encoding is null
-
-
Method Details
-
withEncodingId
Description copied from interface:Encoding
Build an encoding that has the givenEncodingId
but is otherwise equivalent to this encoding.If this encoding already has
encodingId
, then this method may (but is not required to) return this same instance.- Parameters:
encodingId
- new encoding'sEncodingId
, or null for an anonymized encoding- Returns:
- a version of this encoding with the given
EncodingId
-
createTuple
- Specified by:
createTuple
in classTupleEncoding<Tuple2<V1,
V2>>
-