Package org.apache.beam.sdk.coders
Class IterableCoder<T>
java.lang.Object
org.apache.beam.sdk.coders.Coder<Iterable<T>>
org.apache.beam.sdk.coders.StructuredCoder<Iterable<T>>
org.apache.beam.sdk.coders.IterableLikeCoder<T,Iterable<T>>
org.apache.beam.sdk.coders.IterableCoder<T>
- Type Parameters:
T
- the type of the elements of the iterables being transcoded
- All Implemented Interfaces:
Serializable
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.beam.sdk.coders.Coder
Coder.Context, Coder.NonDeterministicException
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondecodeToIterable
(List<T> decodedElements) Builds an instance ofIterableT
, this coder's associatedIterable
-like subtype, from a list of decoded elements.Returns theTypeDescriptor
for the type encoded.static <T> IterableCoder
<T> structuralValue
(Iterable<T> value) Returns an object with anObject.equals()
method that represents structural equality on the argument.Methods inherited from class org.apache.beam.sdk.coders.IterableLikeCoder
decode, decodeToIterable, encode, getCoderArguments, getElemCoder, isRegisterByteSizeObserverCheap, registerByteSizeObserver, verifyDeterministic
Methods inherited from class org.apache.beam.sdk.coders.StructuredCoder
equals, getComponents, hashCode, toString
Methods inherited from class org.apache.beam.sdk.coders.Coder
consistentWithEquals, decode, encode, getEncodedElementByteSize, getEncodedElementByteSizeUsingCoder, verifyDeterministic, verifyDeterministic
-
Constructor Details
-
IterableCoder
-
-
Method Details
-
of
-
structuralValue
Description copied from class:Coder
Returns an object with anObject.equals()
method that represents structural equality on the argument.For any two values
x
andy
of typeT
, if their encoded bytes are the same, then it must be the case thatstructuralValue(x).equals(structuralValue(y))
.Most notably:
- The structural value for an array coder should perform a structural comparison of the contents of the arrays, rather than the default behavior of comparing according to object identity.
- The structural value for a coder accepting
null
should be a proper object with anequals()
method, even if the input value isnull
.
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 abyte[]
, and returns an object that performs array equality on the encoded bytes.- Overrides:
structuralValue
in classCoder<Iterable<T>>
-
decodeToIterable
Description copied from class:IterableLikeCoder
Builds an instance ofIterableT
, this coder's associatedIterable
-like subtype, from a list of decoded elements.Override
IterableLikeCoder.decodeToIterable(List, long, InputStream)
if you need access to the terminator value and theInputStream
.- Specified by:
decodeToIterable
in classIterableLikeCoder<T,
Iterable<T>>
-
getEncodedTypeDescriptor
Description copied from class:Coder
Returns theTypeDescriptor
for the type encoded.- Overrides:
getEncodedTypeDescriptor
in classCoder<Iterable<T>>
-