T - the type of the values being transcodedpublic abstract class StandardCoder<T> extends java.lang.Object implements Coder<T>
getComponents().Coder.Context, Coder.NonDeterministicException| Modifier | Constructor and Description |
|---|---|
protected |
StandardCoder() |
| Modifier and Type | Method and Description |
|---|---|
com.google.cloud.dataflow.sdk.util.CloudObject |
asCloudObject()
Returns the
CloudObject that represents this Coder. |
boolean |
equals(java.lang.Object o) |
java.util.List<? extends Coder<?>> |
getComponents()
Returns the list of
Coders that are components of this
Coder. |
protected long |
getEncodedElementByteSize(T value,
Coder.Context context)
Returns the size in bytes of the encoded value using this
coder.
|
int |
hashCode() |
boolean |
isRegisterByteSizeObserverCheap(T value,
Coder.Context context)
StandardCoder requires elements to be fully encoded and copied
into a byte stream to determine the byte size of the element,
which is considered expensive.
|
void |
registerByteSizeObserver(T value,
com.google.cloud.dataflow.sdk.util.common.ElementByteSizeObserver observer,
Coder.Context context)
Notifies ElementByteSizeObserver about the byte size of the
encoded value using this coder.
|
java.lang.String |
toString() |
void |
verifyDeterministic()
Throw
Coder.NonDeterministicException if the coding is not deterministic. |
protected void |
verifyDeterministic(java.lang.String message,
Coder<?>... coders) |
protected void |
verifyDeterministic(java.lang.String message,
java.lang.Iterable<Coder<?>> coders) |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitdecode, encode, getCoderArguments, isDeterministicpublic java.util.List<? extends Coder<?>> getComponents()
Coders that are components of this
Coder. Returns an empty list if this is an AtomicCoder (or
other Coder with no components).public boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Objectpublic com.google.cloud.dataflow.sdk.util.CloudObject asCloudObject()
CoderCloudObject that represents this Coder.asCloudObject in interface Coder<T>public boolean isRegisterByteSizeObserverCheap(T value, Coder.Context context)
isRegisterByteSizeObserverCheap in interface Coder<T>protected long getEncodedElementByteSize(T value, Coder.Context context) throws java.lang.Exception
java.lang.Exceptionpublic void registerByteSizeObserver(T value, com.google.cloud.dataflow.sdk.util.common.ElementByteSizeObserver observer, Coder.Context context) throws java.lang.Exception
registerByteSizeObserver in interface Coder<T>java.lang.Exceptionpublic void verifyDeterministic()
throws Coder.NonDeterministicException
CoderCoder.NonDeterministicException if the coding is not deterministic.
In order for a Coder to be considered deterministic,
the following must be true:
Object.equals()
or Comparable.compareTo(), if supported), have the same
encoding.
Coder always produces a canonical encoding, which is the
same for an instance of an object even if produced on different
computers at different times.
verifyDeterministic in interface Coder<T>Coder.NonDeterministicException - if this coder is not deterministic.protected void verifyDeterministic(java.lang.String message,
java.lang.Iterable<Coder<?>> coders)
throws Coder.NonDeterministicException
Coder.NonDeterministicExceptionprotected void verifyDeterministic(java.lang.String message,
Coder<?>... coders)
throws Coder.NonDeterministicException
Coder.NonDeterministicException