Project Crunch has retired. For details please refer to its Attic page.
PTypes (Apache Crunch 0.10.0 API)

org.apache.crunch.types
Class PTypes

java.lang.Object
  extended by org.apache.crunch.types.PTypes

public class PTypes
extends Object

Utility functions for creating common types of derived PTypes, e.g., for JSON data, protocol buffers, and Thrift records.


Field Summary
static MapFn<BigInteger,ByteBuffer> BIGINT_TO_BYTE
           
static MapFn<ByteBuffer,BigInteger> BYTE_TO_BIGINT
           
 
Constructor Summary
PTypes()
           
 
Method Summary
static PType<BigInteger> bigInt(PTypeFamily typeFamily)
          A PType for Java's BigInteger type.
static
<T extends Enum>
PType<T>
enums(Class<T> type, PTypeFamily typeFamily)
          Constructs a PType for a Java Enum type.
static
<T> PType<T>
jsonString(Class<T> clazz, PTypeFamily typeFamily)
          Constructs a PType for reading a Java type from a JSON string using Jackson's ObjectMapper.
static
<T extends com.google.protobuf.Message>
PType<T>
protos(Class<T> clazz, PTypeFamily typeFamily)
          Constructs a PType for the given protocol buffer.
static
<T extends com.google.protobuf.Message>
PType<T>
protos(Class<T> clazz, PTypeFamily typeFamily, SerializableSupplier<com.google.protobuf.ExtensionRegistry> supplier)
          Constructs a PType for a protocol buffer, using the given SerializableSupplier to provide an ExtensionRegistry to use in reading the given protobuf.
static
<T extends org.apache.thrift.TBase>
PType<T>
thrifts(Class<T> clazz, PTypeFamily typeFamily)
          Constructs a PType for a Thrift record.
static PType<UUID> uuid(PTypeFamily ptf)
          A PType for Java's UUID type.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BYTE_TO_BIGINT

public static final MapFn<ByteBuffer,BigInteger> BYTE_TO_BIGINT

BIGINT_TO_BYTE

public static final MapFn<BigInteger,ByteBuffer> BIGINT_TO_BYTE
Constructor Detail

PTypes

public PTypes()
Method Detail

bigInt

public static PType<BigInteger> bigInt(PTypeFamily typeFamily)
A PType for Java's BigInteger type.


uuid

public static PType<UUID> uuid(PTypeFamily ptf)
A PType for Java's UUID type.


jsonString

public static <T> PType<T> jsonString(Class<T> clazz,
                                      PTypeFamily typeFamily)
Constructs a PType for reading a Java type from a JSON string using Jackson's ObjectMapper.


protos

public static <T extends com.google.protobuf.Message> PType<T> protos(Class<T> clazz,
                                                                      PTypeFamily typeFamily)
Constructs a PType for the given protocol buffer.


protos

public static <T extends com.google.protobuf.Message> PType<T> protos(Class<T> clazz,
                                                                      PTypeFamily typeFamily,
                                                                      SerializableSupplier<com.google.protobuf.ExtensionRegistry> supplier)
Constructs a PType for a protocol buffer, using the given SerializableSupplier to provide an ExtensionRegistry to use in reading the given protobuf.


thrifts

public static <T extends org.apache.thrift.TBase> PType<T> thrifts(Class<T> clazz,
                                                                   PTypeFamily typeFamily)
Constructs a PType for a Thrift record.


enums

public static <T extends Enum> PType<T> enums(Class<T> type,
                                              PTypeFamily typeFamily)
Constructs a PType for a Java Enum type.



Copyright © 2014 The Apache Software Foundation. All Rights Reserved.