T
- the type of the elements of the iterables being transcodedpublic class IterableCoder<T> extends IterableLikeCoder<T,java.lang.Iterable<T>>
Coder.Context, Coder.NonDeterministicException
Modifier | Constructor and Description |
---|---|
protected |
IterableCoder(Coder<T> elemCoder) |
Modifier and Type | Method and Description |
---|---|
protected java.lang.Iterable<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.lang.Iterable<T>> |
getEncodedTypeDescriptor()
Returns the
TypeDescriptor for the type encoded. |
static <T> IterableCoder<T> |
of(Coder<T> elemCoder) |
java.lang.Object |
structuralValue(java.lang.Iterable<T> value)
Returns an object with an
Object.equals() method that represents structural equality on
the argument. |
decode, decodeToIterable, encode, getCoderArguments, getElemCoder, isRegisterByteSizeObserverCheap, registerByteSizeObserver, verifyDeterministic
equals, getComponents, hashCode, toString
consistentWithEquals, decode, encode, getEncodedElementByteSize, verifyDeterministic, verifyDeterministic
public static <T> IterableCoder<T> of(Coder<T> elemCoder)
public java.lang.Object structuralValue(java.lang.Iterable<T> value)
Coder
Object.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.lang.Iterable<T>>
protected final java.lang.Iterable<T> decodeToIterable(java.util.List<T> decodedElements)
IterableLikeCoder
IterableT
, 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.lang.Iterable<T>>
public TypeDescriptor<java.lang.Iterable<T>> getEncodedTypeDescriptor()
Coder
TypeDescriptor
for the type encoded.getEncodedTypeDescriptor
in class Coder<java.lang.Iterable<T>>