public class TypeDescriptors
extends java.lang.Object
TypeDescriptor objects for different types, such as Java
 primitive types, containers and KVs of other TypeDescriptor objects, and
 extracting type variables of parameterized types (e.g. extracting the OutputT type
 variable of a DoFn<InputT, OutputT>).| Modifier and Type | Class and Description | 
|---|---|
static interface  | 
TypeDescriptors.TypeVariableExtractor<InputT,OutputT>
A helper interface for use with  
extractFromTypeParameters(Object, Class,
 TypeVariableExtractor). | 
| Constructor and Description | 
|---|
TypeDescriptors()  | 
| Modifier and Type | Method and Description | 
|---|---|
static TypeDescriptor<java.math.BigDecimal> | 
bigdecimals()
The  
TypeDescriptor for BigDecimal. | 
static TypeDescriptor<java.math.BigInteger> | 
bigintegers()
The  
TypeDescriptor for BigInteger. | 
static TypeDescriptor<java.lang.Boolean> | 
booleans()
The  
TypeDescriptor for Boolean. | 
static TypeDescriptor<java.lang.Byte> | 
bytes()
The  
TypeDescriptor for Byte. | 
static TypeDescriptor<java.lang.Character> | 
characters()
The  
TypeDescriptor for Character. | 
static TypeDescriptor<java.lang.Double> | 
doubles()
The  
TypeDescriptor for Double. | 
static <T,V> TypeDescriptor<V> | 
extractFromTypeParameters(T instance,
                         java.lang.Class<? super T> supertype,
                         TypeDescriptors.TypeVariableExtractor<T,V> extractor)
Extracts a type from the actual type parameters of a parameterized class, subject to Java type
 erasure. 
 | 
static <T,V> TypeDescriptor<V> | 
extractFromTypeParameters(TypeDescriptor<T> type,
                         java.lang.Class<? super T> supertype,
                         TypeDescriptors.TypeVariableExtractor<T,V> extractor)
Like  
extractFromTypeParameters(Object, Class, TypeVariableExtractor), but takes a
 TypeDescriptor of the instance being analyzed rather than the instance itself. | 
static TypeDescriptor<java.lang.Float> | 
floats()
The  
TypeDescriptor for Float. | 
static <InputT,OutputT> | 
inputOf(Contextful.Fn<InputT,OutputT> fn)
Like  
inputOf(ProcessFunction) but for Contextful.Fn. | 
static <InputT,OutputT> | 
inputOf(ProcessFunction<InputT,OutputT> fn)
Returns a type descriptor for the input of the given  
ProcessFunction, subject to Java
 type erasure: may contain unresolved type variables if the type was erased. | 
static <InputT,OutputT> | 
inputOf(SerializableFunction<InputT,OutputT> fn)
Binary compatibility adapter for  
inputOf(ProcessFunction). | 
static TypeDescriptor<java.lang.Integer> | 
integers()
The  
TypeDescriptor for Integer. | 
static <T> TypeDescriptor<java.lang.Iterable<T>> | 
iterables(TypeDescriptor<T> iterable)
The  
TypeDescriptor for Iterable. | 
static <K,V> TypeDescriptor<KV<K,V>> | 
kvs(TypeDescriptor<K> key,
   TypeDescriptor<V> value)
The  
TypeDescriptor for KV. | 
static <T> TypeDescriptor<java.util.List<T>> | 
lists(TypeDescriptor<T> element)
The  
TypeDescriptor for List. | 
static TypeDescriptor<java.lang.Long> | 
longs()
The  
TypeDescriptor for Long. | 
static <K,V> TypeDescriptor<java.util.Map<K,V>> | 
maps(TypeDescriptor<K> keyType,
    TypeDescriptor<V> valueType)
The  
TypeDescriptor for Map. | 
static TypeDescriptor<java.lang.Void> | 
nulls()
The  
TypeDescriptor for nulls/Void. | 
static <InputT,OutputT> | 
outputOf(Contextful.Fn<InputT,OutputT> fn)
Like  
outputOf(ProcessFunction) but for Contextful.Fn. | 
static <InputT,OutputT> | 
outputOf(ProcessFunction<InputT,OutputT> fn)
Returns a type descriptor for the output of the given  
ProcessFunction, subject to Java
 type erasure: may contain unresolved type variables if the type was erased. | 
static <InputT,OutputT> | 
outputOf(SerializableFunction<InputT,OutputT> fn)
Binary compatibility adapter for  
outputOf(ProcessFunction). | 
static TypeDescriptor<Row> | 
rows()
The  
TypeDescriptor for Row. | 
static <T> TypeDescriptor<java.util.Set<T>> | 
sets(TypeDescriptor<T> element)
The  
TypeDescriptor for Set. | 
static TypeDescriptor<java.lang.Short> | 
shorts()
The  
TypeDescriptor for Short. | 
static TypeDescriptor<java.lang.String> | 
strings()
The  
TypeDescriptor for String. | 
static TypeDescriptor<java.lang.Void> | 
voids()  | 
public static TypeDescriptor<java.lang.Boolean> booleans()
TypeDescriptor for Boolean. This is the equivalent of:
 
 new TypeDescriptor<Boolean>() {};
 TypeDescriptor for Booleanpublic static TypeDescriptor<java.lang.Double> doubles()
TypeDescriptor for Double. This is the equivalent of:
 
 new TypeDescriptor<Double>() {};
 TypeDescriptor for Doublepublic static TypeDescriptor<java.lang.Float> floats()
TypeDescriptor for Float. This is the equivalent of:
 
 new TypeDescriptor<Float>() {};
 TypeDescriptor for Floatpublic static TypeDescriptor<java.lang.Integer> integers()
TypeDescriptor for Integer. This is the equivalent of:
 
 new TypeDescriptor<Integer>() {};
 TypeDescriptor for Integerpublic static TypeDescriptor<java.lang.Long> longs()
TypeDescriptor for Long. This is the equivalent of:
 
 new TypeDescriptor<Long>() {};
 TypeDescriptor for Longpublic static TypeDescriptor<java.lang.Short> shorts()
TypeDescriptor for Short. This is the equivalent of:
 
 new TypeDescriptor<Short>() {};
 TypeDescriptor for Shortpublic static TypeDescriptor<java.math.BigDecimal> bigdecimals()
TypeDescriptor for BigDecimal. This is the equivalent of:
 
 new TypeDescriptor<BigDecimal>() {};
 TypeDescriptor for BigDecimalpublic static TypeDescriptor<java.math.BigInteger> bigintegers()
TypeDescriptor for BigInteger. This is the equivalent of:
 
 new TypeDescriptor<BigInteger>() {};
 TypeDescriptor for BigIntegerpublic static TypeDescriptor<Row> rows()
TypeDescriptor for Rowpublic static TypeDescriptor<java.lang.String> strings()
TypeDescriptor for String. This is the equivalent of:
 
 new TypeDescriptor<String>() {};
 TypeDescriptor for Stringpublic static TypeDescriptor<java.lang.Character> characters()
TypeDescriptor for Character. This is the equivalent of:
 
 new TypeDescriptor<Character>() {};
 TypeDescriptor for Characterpublic static TypeDescriptor<java.lang.Byte> bytes()
TypeDescriptor for Byte. This is the equivalent of:
 
 new TypeDescriptor<Byte>() {};
 TypeDescriptor for Bytepublic static TypeDescriptor<java.lang.Void> nulls()
TypeDescriptor for nulls/Void. This is the equivalent of:
 
 new TypeDescriptor<Void>() {};
 TypeDescriptor for nulls/Voidpublic static <K,V> TypeDescriptor<KV<K,V>> kvs(TypeDescriptor<K> key, TypeDescriptor<V> value)
TypeDescriptor for KV. This is the equivalent of:
 
 new TypeDescriptor<KV<K,V>>() {};
 
 Example of use:
 PCollection<String> words = ...;
 PCollection<KV<String, String>> words = words.apply(FlatMapElements
         .into(TypeDescriptors.kv(TypeDescriptors.strings(), TypeDescriptors.strings()))
         .via(...));
 key - The TypeDescriptor for the keyvalue - The TypeDescriptor for the valueTypeDescriptor for KVpublic static <T> TypeDescriptor<java.util.Set<T>> sets(TypeDescriptor<T> element)
TypeDescriptor for Set. This is the equivalent of:
 
 new TypeDescriptor<Set<E>>() {};
 
 Example of use:
 PCollection<String> words = ...;
 PCollection<Set<String>> words = words.apply(FlatMapElements
         .into(TypeDescriptors.sets(TypeDescriptors.strings()))
         .via(...));
 element - The TypeDescriptor for the setTypeDescriptor for Setpublic static <K,V> TypeDescriptor<java.util.Map<K,V>> maps(TypeDescriptor<K> keyType, TypeDescriptor<V> valueType)
TypeDescriptor for Map.public static <T> TypeDescriptor<java.util.List<T>> lists(TypeDescriptor<T> element)
TypeDescriptor for List. This is the equivalent of:
 
 new TypeDescriptor<List<E>>() {};
 
 Example of use:
 PCollection<String> words = ...;
 PCollection<List<String>> words = words.apply(FlatMapElements
         .into(TypeDescriptors.lists(TypeDescriptors.strings()))
         .via(...));
 element - The TypeDescriptor for the listTypeDescriptor for Listpublic static <T> TypeDescriptor<java.lang.Iterable<T>> iterables(TypeDescriptor<T> iterable)
TypeDescriptor for Iterable. This is the equivalent of:
 
 new TypeDescriptor<Iterable<E>>() {};
 
 Example of use:
 PCollection<String> words = ...;
 PCollection<Iterable<String>> words = words.apply(FlatMapElements
         .into(TypeDescriptors.iterables(TypeDescriptors.strings()))
         .via(...));
 iterable - The TypeDescriptor for the iterableTypeDescriptor for Iterablepublic static TypeDescriptor<java.lang.Void> voids()
public static <T,V> TypeDescriptor<V> extractFromTypeParameters(T instance, java.lang.Class<? super T> supertype, TypeDescriptors.TypeVariableExtractor<T,V> extractor)
Example of use:
 class Foo<BarT> {
   private ProcessFunction<BarT, String> fn;
   TypeDescriptor<BarT> inferBarTypeDescriptorFromFn() {
     return TypeDescriptors.extractFromTypeParameters(
       fn,
       ProcessFunction.class,
       // The actual type of "fn" is matched against the input type of the extractor,
       // and the obtained values of type variables of the superclass are substituted
       // into the output type of the extractor.
       new TypeVariableExtractor<ProcessFunction<BarT, String>, BarT>() {});
   }
 }
 instance - The object being analyzedsupertype - Parameterized superclass of interestextractor - A class for specifying the type to extract from the supertypeTypeDescriptor for the actual value of the result type of the extractor,
     potentially containing unresolved type variables if the type was erased.public static <T,V> TypeDescriptor<V> extractFromTypeParameters(TypeDescriptor<T> type, java.lang.Class<? super T> supertype, TypeDescriptors.TypeVariableExtractor<T,V> extractor)
extractFromTypeParameters(Object, Class, TypeVariableExtractor), but takes a
 TypeDescriptor of the instance being analyzed rather than the instance itself.public static <InputT,OutputT> TypeDescriptor<InputT> inputOf(ProcessFunction<InputT,OutputT> fn)
ProcessFunction, subject to Java
 type erasure: may contain unresolved type variables if the type was erased.public static <InputT,OutputT> TypeDescriptor<InputT> inputOf(SerializableFunction<InputT,OutputT> fn)
inputOf(ProcessFunction).public static <InputT,OutputT> TypeDescriptor<OutputT> outputOf(ProcessFunction<InputT,OutputT> fn)
ProcessFunction, subject to Java
 type erasure: may contain unresolved type variables if the type was erased.public static <InputT,OutputT> TypeDescriptor<OutputT> outputOf(SerializableFunction<InputT,OutputT> fn)
outputOf(ProcessFunction).public static <InputT,OutputT> TypeDescriptor<InputT> inputOf(Contextful.Fn<InputT,OutputT> fn)
inputOf(ProcessFunction) but for Contextful.Fn.public static <InputT,OutputT> TypeDescriptor<OutputT> outputOf(Contextful.Fn<InputT,OutputT> fn)
outputOf(ProcessFunction) but for Contextful.Fn.