Package com.nickrobison.tuple
Class TupleSchema.Builder
- java.lang.Object
-
- com.nickrobison.tuple.TupleSchema.Builder
-
- Direct Known Subclasses:
DirectTupleSchema.Builder
,HeapTupleSchema.Builder
- Enclosing class:
- TupleSchema
public static class TupleSchema.Builder extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description Builder()
Builder(TupleSchema.Builder builder)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TupleSchema.Builder
addField(java.lang.String fieldName, java.lang.Class fieldType)
Adds a field name and type to the schema.TupleSchema.Builder
addFieldNames(java.lang.Iterable<java.lang.String> fieldNames)
TupleSchema.Builder
addFieldNames(java.lang.String... fieldNames)
TupleSchema.Builder
addFieldTypes(java.lang.Class... fieldTypes)
TupleSchema.Builder
addFieldTypes(java.lang.Iterable<java.lang.Class> fieldTypes)
DirectTupleSchema.Builder
directMemory()
Causes this schema to allocate its memory off of the main java heap.TupleSchema.Builder
expandingPool()
Specifies that the tuple pool should allocate more tuples when it becomes exhausted.HeapTupleSchema.Builder
heapMemory()
Causes this schema to allocate its memory on heap, and fully reachable by GC.TupleSchema.Builder
implementInterface(java.lang.Class iface)
The generated FastTuple subclass will implement the passed in interface.TupleSchema.Builder
poolOfSize(int poolSize)
Sets the initial size for each thread local tuple pool.
-
-
-
Constructor Detail
-
Builder
public Builder(TupleSchema.Builder builder)
-
Builder
public Builder()
-
-
Method Detail
-
addField
public TupleSchema.Builder addField(java.lang.String fieldName, java.lang.Class fieldType)
Adds a field name and type to the schema. Field names end up as both method names and field names in the generated class, therefore they have the same restrictions on allowable characters. Passing in an illegal name will cause a CompileException during the call to build.- Parameters:
fieldName
- - Name of fieldfieldType
- -Class
type of field- Returns:
- -
TupleSchema.Builder
-
implementInterface
public TupleSchema.Builder implementInterface(java.lang.Class iface)
The generated FastTuple subclass will implement the passed in interface. FastTuple's produced from this schema can then be cast to the interface type, for type safe invocation of the desired methods.- Parameters:
iface
- -Class
interface to implement- Returns:
- -
TupleSchema.Builder
-
addFieldNames
public TupleSchema.Builder addFieldNames(java.lang.String... fieldNames)
-
addFieldNames
public TupleSchema.Builder addFieldNames(java.lang.Iterable<java.lang.String> fieldNames)
-
addFieldTypes
public TupleSchema.Builder addFieldTypes(java.lang.Class... fieldTypes)
-
addFieldTypes
public TupleSchema.Builder addFieldTypes(java.lang.Iterable<java.lang.Class> fieldTypes)
-
poolOfSize
public TupleSchema.Builder poolOfSize(int poolSize)
Sets the initial size for each thread local tuple pool. The total number of tuples that will be allocated can be found by multiplying this number by the number of threads that will be checking tuples out of the pool.- Parameters:
poolSize
- - The size to generate specified in number of tuples.- Returns:
- -
TupleSchema.Builder
-
expandingPool
public TupleSchema.Builder expandingPool()
Specifies that the tuple pool should allocate more tuples when it becomes exhausted. Otherwise, an exhausted pool will throw an IllegalStateException.- Returns:
- -
TupleSchema.Builder
-
directMemory
public DirectTupleSchema.Builder directMemory()
Causes this schema to allocate its memory off of the main java heap.- Returns:
- -
TupleSchema.Builder
-
heapMemory
public HeapTupleSchema.Builder heapMemory()
Causes this schema to allocate its memory on heap, and fully reachable by GC.- Returns:
- -
TupleSchema.Builder
-
-