public class ClassGenerator<T> extends Object
Modifier and Type | Class and Description |
---|---|
static class |
ClassGenerator.BlkCreateMode |
static class |
ClassGenerator.BlockType |
static class |
ClassGenerator.HoldingContainer
Represents a (Nullable)?(Type)Holder instance.
|
Modifier and Type | Field and Description |
---|---|
com.sun.codemodel.JDefinedClass |
clazz |
static GeneratorMapping |
DEFAULT_CONSTANT_MAP |
static GeneratorMapping |
DEFAULT_SCALAR_MAP |
static String |
INNER_CLASS_FIELD_NAME |
Modifier and Type | Method and Description |
---|---|
ClassGenerator.HoldingContainer |
addExpr(LogicalExpression ex) |
ClassGenerator.HoldingContainer |
addExpr(LogicalExpression ex,
ClassGenerator.BlkCreateMode mode) |
protected com.sun.codemodel.JBlock |
createInnerEvalBlock()
Creates an inner braced and indented block for evaluation of the expression.
|
ClassGenerator.HoldingContainer |
declare(TypeProtos.MajorType t) |
ClassGenerator.HoldingContainer |
declare(TypeProtos.MajorType t,
boolean includeNewInstance) |
ClassGenerator.HoldingContainer |
declare(TypeProtos.MajorType t,
String name,
boolean includeNewInstance)
Adds a local variable declaration based on given name and type.
|
org.apache.calcite.util.Pair<Integer,com.sun.codemodel.JVar> |
declareClassConstField(String prefix,
com.sun.codemodel.JType t,
org.apache.drill.shaded.guava.com.google.common.base.Function<DrillBuf,? extends ValueHolder> function) |
org.apache.calcite.util.Pair<Integer,com.sun.codemodel.JVar> |
declareClassConstField(String prefix,
com.sun.codemodel.JType t,
com.sun.codemodel.JExpression init,
org.apache.drill.shaded.guava.com.google.common.base.Function<DrillBuf,? extends ValueHolder> function)
Declare a constant field for the class.
|
com.sun.codemodel.JVar |
declareClassField(String prefix,
com.sun.codemodel.JType t) |
com.sun.codemodel.JVar |
declareClassField(String prefix,
com.sun.codemodel.JType t,
com.sun.codemodel.JExpression init) |
com.sun.codemodel.JVar |
declareVectorValueSetupAndMember(DirectExpression batchName,
TypedFieldId fieldId)
Creates class variable for the value vector using metadata from
fieldId
and initializes it using setup blocks. |
com.sun.codemodel.JVar |
declareVectorValueSetupAndMember(String batchName,
TypedFieldId fieldId) |
com.sun.codemodel.JBlock |
getBlock(ClassGenerator.BlockType type) |
com.sun.codemodel.JBlock |
getBlock(String methodName) |
com.sun.codemodel.JBlock |
getCleanupBlock() |
CodeGenerator<T> |
getCodeGenerator() |
Map<org.apache.calcite.util.Pair<Integer,com.sun.codemodel.JVar>,org.apache.drill.shaded.guava.com.google.common.base.Function<DrillBuf,? extends ValueHolder>> |
getConstantVars() |
static MappingSet |
getDefaultMapping() |
com.sun.codemodel.JBlock |
getEvalBlock() |
com.sun.codemodel.JLabel |
getEvalBlockLabel(String prefix) |
com.sun.codemodel.JType |
getHolderType(TypeProtos.MajorType t) |
ClassGenerator<T> |
getInnerGenerator(String name) |
MappingSet |
getMappingSet() |
com.sun.codemodel.JCodeModel |
getModel() |
String |
getNextVar() |
String |
getNextVar(String prefix) |
com.sun.codemodel.JBlock |
getResetBlock() |
com.sun.codemodel.JBlock |
getSetupBlock() |
List<TypedFieldId> |
getWorkspaceTypes() |
Map<WorkspaceReference,com.sun.codemodel.JVar> |
getWorkspaceVectors() |
void |
nestEvalBlock(com.sun.codemodel.JBlock block) |
void |
preparePlainJava()
Prepare the generated class for use as a plain-old Java class
(to be compiled by a compiler and directly loaded without a
byte-code merge.
|
void |
rotateBlock() |
void |
setMappingSet(MappingSet mappings) |
void |
unNestEvalBlock() |
public static final GeneratorMapping DEFAULT_SCALAR_MAP
public static final GeneratorMapping DEFAULT_CONSTANT_MAP
public static final String INNER_CLASS_FIELD_NAME
public final com.sun.codemodel.JDefinedClass clazz
public static MappingSet getDefaultMapping()
public ClassGenerator<T> getInnerGenerator(String name)
public MappingSet getMappingSet()
public void setMappingSet(MappingSet mappings)
public CodeGenerator<T> getCodeGenerator()
public com.sun.codemodel.JBlock getBlock(String methodName)
public com.sun.codemodel.JBlock getBlock(ClassGenerator.BlockType type)
public com.sun.codemodel.JBlock getSetupBlock()
public com.sun.codemodel.JBlock getEvalBlock()
public com.sun.codemodel.JBlock getResetBlock()
public com.sun.codemodel.JBlock getCleanupBlock()
public void nestEvalBlock(com.sun.codemodel.JBlock block)
public void unNestEvalBlock()
public com.sun.codemodel.JLabel getEvalBlockLabel(String prefix)
protected com.sun.codemodel.JBlock createInnerEvalBlock()
public com.sun.codemodel.JVar declareVectorValueSetupAndMember(String batchName, TypedFieldId fieldId)
public com.sun.codemodel.JVar declareVectorValueSetupAndMember(DirectExpression batchName, TypedFieldId fieldId)
fieldId
and initializes it using setup blocks.batchName
- expression for invoking getValueAccessorById
methodfieldId
- metadata of the field that should be declaredpublic ClassGenerator.HoldingContainer addExpr(LogicalExpression ex)
public ClassGenerator.HoldingContainer addExpr(LogicalExpression ex, ClassGenerator.BlkCreateMode mode)
public void rotateBlock()
public com.sun.codemodel.JCodeModel getModel()
public String getNextVar()
public com.sun.codemodel.JVar declareClassField(String prefix, com.sun.codemodel.JType t)
public com.sun.codemodel.JVar declareClassField(String prefix, com.sun.codemodel.JType t, com.sun.codemodel.JExpression init)
public org.apache.calcite.util.Pair<Integer,com.sun.codemodel.JVar> declareClassConstField(String prefix, com.sun.codemodel.JType t, org.apache.drill.shaded.guava.com.google.common.base.Function<DrillBuf,? extends ValueHolder> function)
public org.apache.calcite.util.Pair<Integer,com.sun.codemodel.JVar> declareClassConstField(String prefix, com.sun.codemodel.JType t, com.sun.codemodel.JExpression init, org.apache.drill.shaded.guava.com.google.common.base.Function<DrillBuf,? extends ValueHolder> function)
prefix
- the prefix name of class fieldt
- the type of class fieldinit
- init expressionfunction
- holds the constant value which
returns a value holder must be set to the class field when the class instance created.public Map<org.apache.calcite.util.Pair<Integer,com.sun.codemodel.JVar>,org.apache.drill.shaded.guava.com.google.common.base.Function<DrillBuf,? extends ValueHolder>> getConstantVars()
public ClassGenerator.HoldingContainer declare(TypeProtos.MajorType t)
public ClassGenerator.HoldingContainer declare(TypeProtos.MajorType t, boolean includeNewInstance)
public ClassGenerator.HoldingContainer declare(TypeProtos.MajorType t, String name, boolean includeNewInstance)
t
- major typename
- variable nameincludeNewInstance
- whether to create new instancepublic List<TypedFieldId> getWorkspaceTypes()
public Map<WorkspaceReference,com.sun.codemodel.JVar> getWorkspaceVectors()
public void preparePlainJava()
public com.sun.codemodel.JType getHolderType(TypeProtos.MajorType t)
Copyright © 1970 The Apache Software Foundation. All rights reserved.