public final class CoderProviders extends Object
CoderProviders.| Modifier and Type | Method and Description |
|---|---|
static CoderProvider |
firstOf(CoderProvider... coderProviders)
Returns a
CoderProvider that consults each of the provider coderProviders
and returns the first Coder provided. |
static <T> CoderProvider |
fromStaticMethods(Class<T> clazz)
Creates a
CoderProvider built from particular static methods of a class that
implements Coder. |
public static <T> CoderProvider fromStaticMethods(Class<T> clazz)
CoderProvider built from particular static methods of a class that
implements Coder. The requirements for this method are precisely the requirements
for a Coder class to be usable with DefaultCoder annotations.
The class must have the following static method:
public static Coder<T> of(TypeDescriptor<T> type)
public static CoderProvider firstOf(CoderProvider... coderProviders)
CoderProvider that consults each of the provider coderProviders
and returns the first Coder provided.
Note that the order in which the providers are listed matters: While the set of types
handled will be the union of those handled by all of the providers in the list, the actual
Coder provided by the first successful provider may differ, and may have inferior
properties. For example, not all Coders are deterministic, handle null
values, or have comparable performance.