com.cloudera.crunch.type.avro
Class Avros

java.lang.Object
  extended by com.cloudera.crunch.type.avro.Avros

public class Avros
extends Object

Defines static methods that are analogous to the methods defined in AvroTypeFamily for convenient static importing.


Field Summary
static MapFn<Object,ByteBuffer> BYTES_IN
           
static ReflectDataFactory REFLECT_DATA_FACTORY
          The instance we use for generating reflected schemas.
static MapFn<String,org.apache.avro.util.Utf8> STRING_TO_UTF8
           
static MapFn<CharSequence,String> UTF8_TO_STRING
           
 
Method Summary
static AvroType<Boolean> booleans()
           
static AvroType<ByteBuffer> bytes()
           
static
<T> AvroType<Collection<T>>
collections(PType<T> ptype)
           
static void configureReflectDataFactory(org.apache.hadoop.conf.Configuration conf)
           
static
<T> AvroType<T>
containers(Class<T> clazz)
           
static
<S,T> AvroType<T>
derived(Class<T> clazz, MapFn<S,T> inputFn, MapFn<T,S> outputFn, PType<S> base)
           
static AvroType<Double> doubles()
           
static AvroType<Float> floats()
           
static AvroType<org.apache.avro.generic.GenericData.Record> generics(org.apache.avro.Schema schema)
           
static
<T> PType<T>
getPrimitiveType(Class<T> clazz)
           
static ReflectDataFactory getReflectDataFactory(org.apache.hadoop.conf.Configuration conf)
           
static AvroType<Integer> ints()
           
static
<T> PType<T>
jsons(Class<T> clazz)
           
static AvroType<Long> longs()
           
static
<T> AvroType<Map<String,T>>
maps(PType<T> ptype)
           
static AvroType<Void> nulls()
           
static
<V1,V2> AvroType<Pair<V1,V2>>
pairs(PType<V1> p1, PType<V2> p2)
           
static
<V1,V2,V3,V4>
AvroType<Tuple4<V1,V2,V3,V4>>
quads(PType<V1> p1, PType<V2> p2, PType<V3> p3, PType<V4> p4)
           
static
<T> AvroType<T>
records(Class<T> clazz)
           
static
<T> AvroType<T>
reflects(Class<T> clazz)
           
static
<T> void
register(Class<T> clazz, AvroType<T> ptype)
           
static AvroType<String> strings()
           
static
<K,V> AvroTableType<K,V>
tableOf(PType<K> key, PType<V> value)
           
static
<V1,V2,V3> AvroType<Tuple3<V1,V2,V3>>
triples(PType<V1> p1, PType<V2> p2, PType<V3> p3)
           
static
<T extends Tuple>
AvroType<T>
tuples(Class<T> clazz, PType... ptypes)
           
static AvroType<TupleN> tuples(PType... ptypes)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REFLECT_DATA_FACTORY

public static ReflectDataFactory REFLECT_DATA_FACTORY
The instance we use for generating reflected schemas. May be modified by clients (e.g., Scrunch.)


UTF8_TO_STRING

public static MapFn<CharSequence,String> UTF8_TO_STRING

STRING_TO_UTF8

public static MapFn<String,org.apache.avro.util.Utf8> STRING_TO_UTF8

BYTES_IN

public static MapFn<Object,ByteBuffer> BYTES_IN
Method Detail

configureReflectDataFactory

public static void configureReflectDataFactory(org.apache.hadoop.conf.Configuration conf)

getReflectDataFactory

public static ReflectDataFactory getReflectDataFactory(org.apache.hadoop.conf.Configuration conf)

register

public static <T> void register(Class<T> clazz,
                                AvroType<T> ptype)

getPrimitiveType

public static <T> PType<T> getPrimitiveType(Class<T> clazz)

nulls

public static final AvroType<Void> nulls()

strings

public static final AvroType<String> strings()

longs

public static final AvroType<Long> longs()

ints

public static final AvroType<Integer> ints()

floats

public static final AvroType<Float> floats()

doubles

public static final AvroType<Double> doubles()

booleans

public static final AvroType<Boolean> booleans()

bytes

public static final AvroType<ByteBuffer> bytes()

records

public static final <T> AvroType<T> records(Class<T> clazz)

generics

public static final AvroType<org.apache.avro.generic.GenericData.Record> generics(org.apache.avro.Schema schema)

containers

public static final <T> AvroType<T> containers(Class<T> clazz)

reflects

public static final <T> AvroType<T> reflects(Class<T> clazz)

collections

public static final <T> AvroType<Collection<T>> collections(PType<T> ptype)

maps

public static final <T> AvroType<Map<String,T>> maps(PType<T> ptype)

pairs

public static final <V1,V2> AvroType<Pair<V1,V2>> pairs(PType<V1> p1,
                                                        PType<V2> p2)

triples

public static final <V1,V2,V3> AvroType<Tuple3<V1,V2,V3>> triples(PType<V1> p1,
                                                                  PType<V2> p2,
                                                                  PType<V3> p3)

quads

public static final <V1,V2,V3,V4> AvroType<Tuple4<V1,V2,V3,V4>> quads(PType<V1> p1,
                                                                      PType<V2> p2,
                                                                      PType<V3> p3,
                                                                      PType<V4> p4)

tuples

public static final AvroType<TupleN> tuples(PType... ptypes)

tuples

public static <T extends Tuple> AvroType<T> tuples(Class<T> clazz,
                                                   PType... ptypes)

derived

public static final <S,T> AvroType<T> derived(Class<T> clazz,
                                              MapFn<S,T> inputFn,
                                              MapFn<T,S> outputFn,
                                              PType<S> base)

jsons

public static <T> PType<T> jsons(Class<T> clazz)

tableOf

public static final <K,V> AvroTableType<K,V> tableOf(PType<K> key,
                                                     PType<V> value)


Copyright © 2012. All Rights Reserved.