public static class TimerOrElement.TimerOrElementCoder<T> extends StandardCoder<TimerOrElement<T>>
ByteSizeObserver calls to an underlying element coder.
TimerOrElement objects never need to be encoded, so this class does not
support the encode and decode methods.Coder.Context, Coder.NonDeterministicException| Modifier and Type | Method and Description |
|---|---|
TimerOrElement<T> |
decode(InputStream inStream,
Coder.Context context)
Decodes a value of type
T from the given input stream in
the given context. |
void |
encode(TimerOrElement<T> value,
OutputStream outStream,
Coder.Context context)
Encodes the given value of type
T onto the given output stream
in the given context. |
List<? extends Coder<?>> |
getCoderArguments()
If this is a
Coder for a parameterized type, returns the
list of Coders being used for each of the parameters, or
returns null if this cannot be done or this is not a
parameterized type. |
Coder<T> |
getElementCoder() |
boolean |
isRegisterByteSizeObserverCheap(TimerOrElement<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. |
static <T> TimerOrElement.TimerOrElementCoder<T> |
of(Coder<T> elemCoder)
Creates a new
TimerOrElement.Coder that wraps the given Coder. |
static TimerOrElement.TimerOrElementCoder<?> |
of(List<Object> components) |
void |
registerByteSizeObserver(TimerOrElement<T> value,
ElementByteSizeObserver observer,
Coder.Context context)
Notifies ElementByteSizeObserver about the byte size of the
encoded value using this coder.
|
void |
verifyDeterministic()
Throw
Coder.NonDeterministicException if the coding is not deterministic. |
asCloudObject, consistentWithEquals, equals, getAllowedEncodings, getComponents, getEncodedElementByteSize, getEncodingId, hashCode, structuralValue, toString, verifyDeterministic, verifyDeterministicpublic static <T> TimerOrElement.TimerOrElementCoder<T> of(Coder<T> elemCoder)
TimerOrElement.Coder that wraps the given Coder.public static TimerOrElement.TimerOrElementCoder<?> of(List<Object> components)
public void encode(TimerOrElement<T> value, OutputStream outStream, Coder.Context context)
CoderT onto the given output stream
in the given context.public TimerOrElement<T> decode(InputStream inStream, Coder.Context context)
CoderT from the given input stream in
the given context. Returns the decoded value.public boolean isRegisterByteSizeObserverCheap(TimerOrElement<T> value, Coder.Context context)
StandardCoderStandardCoder requires elements to be fully encoded and copied
into a byte stream to determine the byte size of the element, which is
considered expensive.isRegisterByteSizeObserverCheap in interface Coder<TimerOrElement<T>>isRegisterByteSizeObserverCheap in class StandardCoder<TimerOrElement<T>>public void registerByteSizeObserver(TimerOrElement<T> value, ElementByteSizeObserver observer, Coder.Context context) throws Exception
StandardCoderregisterByteSizeObserver in interface Coder<TimerOrElement<T>>registerByteSizeObserver in class StandardCoder<TimerOrElement<T>>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.
Coder.NonDeterministicException - if this coder is not deterministic.public List<? extends Coder<?>> getCoderArguments()
CoderCoder for a parameterized type, returns the
list of Coders being used for each of the parameters, or
returns null if this cannot be done or this is not a
parameterized type.