T - the type of the elements of the Deques being transcodedpublic class DequeCoder<T> extends IterableLikeCoder<T,java.util.Deque<T>>
Coder.Context, Coder.NonDeterministicException| Modifier | Constructor and Description |
|---|---|
protected |
DequeCoder(Coder<T> elemCoder) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
consistentWithEquals()
|
protected java.util.Deque<T> |
decodeToIterable(java.util.List<T> decodedElements)
Builds an instance of
IterableT, this coder's associated Iterable-like subtype,
from a list of decoded elements. |
TypeDescriptor<java.util.Deque<T>> |
getEncodedTypeDescriptor()
Returns the
TypeDescriptor for the type encoded. |
static <T> DequeCoder<T> |
of(Coder<T> elemCoder) |
java.lang.Object |
structuralValue(java.util.Deque<T> values)
Returns an object with an
Object.equals() method that represents structural equality on
the argument. |
void |
verifyDeterministic()
Deque sizes are always known, so DequeIterable may be deterministic while the general
IterableLikeCoder is not.
|
decode, decodeToIterable, encode, getCoderArguments, getElemCoder, isRegisterByteSizeObserverCheap, registerByteSizeObserverequals, getComponents, hashCode, toStringdecode, encode, getEncodedElementByteSize, verifyDeterministic, verifyDeterministicpublic static <T> DequeCoder<T> of(Coder<T> elemCoder)
protected java.util.Deque<T> decodeToIterable(java.util.List<T> decodedElements)
IterableLikeCoderIterableT, this coder's associated Iterable-like subtype,
from a list of decoded elements.
Override IterableLikeCoder.decodeToIterable(List, long, InputStream) if you need access to the
terminator value and the InputStream.
decodeToIterable in class IterableLikeCoder<T,java.util.Deque<T>>public boolean consistentWithEquals()
Codertrue if this Coder is injective with respect to Object.equals(java.lang.Object).
Whenever the encoded bytes of two values are equal, then the original values are equal
according to Objects.equals(). Note that this is well-defined for null.
This condition is most notably false for arrays. More generally, this condition is false
whenever equals() compares object identity, rather than performing a
semantic/structural comparison.
By default, returns false.
consistentWithEquals in class Coder<java.util.Deque<T>>public java.lang.Object structuralValue(java.util.Deque<T> values)
CoderObject.equals() method that represents structural equality on
the argument.
For any two values x and y of type T, if their encoded bytes are the
same, then it must be the case that structuralValue(x).equals(structuralValue(y)).
Most notably:
null should be a proper object with an
equals() method, even if the input value is null.
See also Coder.consistentWithEquals().
By default, if this coder is Coder.consistentWithEquals(), and the value is not null,
returns the provided object. Otherwise, encodes the value into a byte[], and returns an
object that performs array equality on the encoded bytes.
structuralValue in class Coder<java.util.Deque<T>>public void verifyDeterministic()
throws Coder.NonDeterministicException
verifyDeterministic in class IterableLikeCoder<T,java.util.Deque<T>>Coder.NonDeterministicException - if this coder is not deterministic.public TypeDescriptor<java.util.Deque<T>> getEncodedTypeDescriptor()
CoderTypeDescriptor for the type encoded.getEncodedTypeDescriptor in class Coder<java.util.Deque<T>>