public class WrapperClassGenerator
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
GENERATED_EVAL_PACKAGE |
static java.lang.String |
GENERATED_INVOKER_PACKAGE |
static int |
MODIFIERS |
Constructor and Description |
---|
WrapperClassGenerator() |
Modifier and Type | Method and Description |
---|---|
static java.io.File |
createFile(java.lang.String name,
java.lang.String text)
Creates a java file inside the folder generated_src
|
static <T> java.io.File |
generateEvalClass(java.lang.String name,
java.lang.String code,
java.lang.Class<T> functionalInterface,
java.lang.String[] paramNames,
java.lang.Class<?>[] parametrizationClasses)
Generates a class to wrap the dynamic user code and compile it.
|
static <T> java.io.File |
generateEvalClass(java.lang.String name,
java.lang.String code,
java.lang.Class<T> functionalInterface,
java.lang.String[] paramNames,
java.lang.Class<?>[] parametrizationClasses,
java.util.Map<java.lang.String,java.lang.Class<?>> environment)
Generates a class to wrap the dynamic user code and compile it.
|
static <T> java.io.File |
generateEvalClass(java.lang.String name,
java.lang.String code,
java.lang.Class<T> functionalInterface,
java.lang.String[] paramNames,
java.lang.String[] imports,
java.lang.Class<?>[] parametrizationClasses)
Generates a class to wrap the dynamic user code and compile it.
|
static java.io.File |
generateFieldGetter(java.lang.String className,
java.lang.Class<?> targetClass,
java.lang.String fieldName,
java.lang.Class<?> functionalInterface,
java.lang.Class<?>[] parametrizationClasses,
boolean isStatic)
Wraps fieldGetter invocation
|
static java.io.File |
generateFieldSetter(java.lang.String className,
java.lang.Class<?> targetClass,
java.lang.String fieldName,
java.lang.Class<?> functionalInterface,
java.lang.Class<?>[] parametrizationClasses,
boolean isStatic)
Wraps fieldSetter invocation
|
static java.io.File |
generateMethodInvoker(java.lang.String className,
java.lang.Class<?> targetClass,
java.lang.String methodName,
java.lang.Class<?> functionalInterface,
java.lang.Class<?>[] parametrizationClasses,
boolean isStatic)
Wraps method invocation
|
public static final java.lang.String GENERATED_INVOKER_PACKAGE
public static final java.lang.String GENERATED_EVAL_PACKAGE
public static final int MODIFIERS
public static <T> java.io.File generateEvalClass(java.lang.String name, java.lang.String code, java.lang.Class<T> functionalInterface, java.lang.String[] paramNames, java.lang.Class<?>[] parametrizationClasses) throws StructuralIntercessionException
name
- The name of the classcode
- The code to wrapfunctionalInterface
- The functional interface to invoke the dynamic codeparamNames
- The parameter namesparametrizationClasses
- The parametrization classes for the interfaceStructuralIntercessionException
public static <T> java.io.File generateEvalClass(java.lang.String name, java.lang.String code, java.lang.Class<T> functionalInterface, java.lang.String[] paramNames, java.lang.String[] imports, java.lang.Class<?>[] parametrizationClasses) throws StructuralIntercessionException
name
- The name of the classcode
- The code to wrapfunctionalInterface
- The functional interface to invoke the dynamic codeparamNames
- The parameter namesimports
- imports to include in the generated code ("java.awt.*",
"java.util.Vector").parametrizationClasses
- The parametrization classes for the interfaceStructuralIntercessionException
public static <T> java.io.File generateEvalClass(java.lang.String name, java.lang.String code, java.lang.Class<T> functionalInterface, java.lang.String[] paramNames, java.lang.Class<?>[] parametrizationClasses, java.util.Map<java.lang.String,java.lang.Class<?>> environment) throws StructuralIntercessionException
EnvironmentSetUp
interface.name
- The name of the classcode
- The code to wrapfunctionalInterface
- The functional interface to invoke the dynamic codeparamNames
- The parameter namesparametrizationClasses
- The parametrization classes for the interfaceenvironment
- The global fields declarations for the wrapper classStructuralIntercessionException
public static java.io.File generateMethodInvoker(java.lang.String className, java.lang.Class<?> targetClass, java.lang.String methodName, java.lang.Class<?> functionalInterface, java.lang.Class<?>[] parametrizationClasses, boolean isStatic) throws StructuralIntercessionException
className
- The class nametargetClass
- The class that owns the methodmethodName
- Method namefunctionalInterface
- The functional interface to invoke the callparametrizationClasses
- Parametrization classes for the interfaceisStatic
- If the method is staticStructuralIntercessionException
public static java.io.File generateFieldGetter(java.lang.String className, java.lang.Class<?> targetClass, java.lang.String fieldName, java.lang.Class<?> functionalInterface, java.lang.Class<?>[] parametrizationClasses, boolean isStatic) throws StructuralIntercessionException
className
- The class nametargetClass
- The class that owns the fieldfieldName
- Field namefunctionalInterface
- The functional interface to make the callparametrizationClasses
- Parametrization classes for the interfaceisStatic
- If the field is staticStructuralIntercessionException
public static java.io.File generateFieldSetter(java.lang.String className, java.lang.Class<?> targetClass, java.lang.String fieldName, java.lang.Class<?> functionalInterface, java.lang.Class<?>[] parametrizationClasses, boolean isStatic) throws StructuralIntercessionException
className
- The class nametargetClass
- The class that owns the fieldfieldName
- Field namefunctionalInterface
- The functional interface to make the callparametrizationClasses
- Parametrization classes for the interfaceisStatic
- If the field is staticStructuralIntercessionException
public static java.io.File createFile(java.lang.String name, java.lang.String text) throws StructuralIntercessionException
name
- The name of the filetext
- The content of the fileFile
objectStructuralIntercessionException