T
- The interface that results from compiling and merging the runtime
code that is generated.public class CodeGenerator<T> extends Object
Drill supports two ways to generate and compile the code from a code generator: via byte-code manipulations or as "plain Java."
When using byte-code transformations, the code generator is used with a class transformer to merge precompiled template code with runtime generated and compiled query specific code to create a runtime instance.
The code generator can optionally be marked as "plain Java" capable.
This means that the generated code can be compiled directly as a Java
class without the normal byte-code manipulations. Plain Java allows
the option to persist, and debug, the generated code when building new
generated classes or otherwise working with generated code. To turn
on debugging, see the explanation in ClassBuilder
.
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
void |
generate() |
String |
generateAndGet() |
static <T> CodeGenerator<T> |
get(MappingSet mappingSet,
TemplateClassDefinition<T> definition,
OptionSet optionManager) |
static <T> CodeGenerator<T> |
get(TemplateClassDefinition<T> definition) |
static <T> CodeGenerator<T> |
get(TemplateClassDefinition<T> definition,
OptionSet optionManager) |
String |
getClassName() |
TemplateClassDefinition<T> |
getDefinition() |
String |
getGeneratedCode() |
String |
getMaterializedClassName() |
ClassGenerator<T> |
getRoot() |
static <T> ClassGenerator<T> |
getRoot(MappingSet mappingSet,
TemplateClassDefinition<T> definition,
OptionSet optionManager) |
static <T> ClassGenerator<T> |
getRoot(TemplateClassDefinition<T> definition,
OptionSet optionManager) |
int |
hashCode() |
boolean |
isCodeToBeSaved() |
boolean |
isPlainJava() |
void |
plainJavaCapable(boolean flag)
Indicates that the code for this class can be generated using the
"Plain Java" mechanism based on inheritance.
|
void |
preferPlainJava(boolean flag)
Identifies that this generated class should be generated via the
plain Java mechanism.
|
void |
saveCodeForDebugging(boolean persist)
Debug-time option to persist the code for the generated class to permit debugging.
|
boolean |
supportsPlainJava() |
public void plainJavaCapable(boolean flag)
flag
- true if the code generated from this instance is
ready to be compiled as a plain Java classpublic void preferPlainJava(boolean flag)
flag
- true if the class should be generated and compiled
as a plain Java class (rather than via byte-code manipulations)public boolean supportsPlainJava()
public boolean isPlainJava()
public void saveCodeForDebugging(boolean persist)
ClassBuilder
.
To debug code, set this option, then point your IDE to the code directory
when the IDE prompts you for the source code location.persist
- true to write the code to disk, false (the default) to keep
code only in memory.public boolean isCodeToBeSaved()
public ClassGenerator<T> getRoot()
public void generate()
public String generateAndGet() throws IOException
IOException
public String getGeneratedCode()
public TemplateClassDefinition<T> getDefinition()
public String getMaterializedClassName()
public String getClassName()
public static <T> CodeGenerator<T> get(TemplateClassDefinition<T> definition)
public static <T> CodeGenerator<T> get(TemplateClassDefinition<T> definition, OptionSet optionManager)
public static <T> ClassGenerator<T> getRoot(TemplateClassDefinition<T> definition, OptionSet optionManager)
public static <T> ClassGenerator<T> getRoot(MappingSet mappingSet, TemplateClassDefinition<T> definition, OptionSet optionManager)
public static <T> CodeGenerator<T> get(MappingSet mappingSet, TemplateClassDefinition<T> definition, OptionSet optionManager)
Copyright © 1970 The Apache Software Foundation. All rights reserved.