public class CommonCompiler extends Object
Modifier and Type | Class and Description |
---|---|
static class |
CommonCompiler.JavaTypesResolver |
Modifier and Type | Field and Description |
---|---|
protected Map<ClassType,String> |
classNames |
static String |
COMPILE_NAME |
protected Map<FunctionSignature,String> |
formNames |
protected Map<com.whitestein.lsps.model.ProcessModel,String> |
hashMappings |
Constructor and Description |
---|
CommonCompiler(boolean generateClass,
boolean generateSource,
SrcClass srcClass,
Map<com.whitestein.lsps.model.ProcessModel,String> hashMappings,
Map<ClassType,String> classNames,
Map<FunctionSignature,String> formNames)
Creates new instance.
|
Modifier and Type | Method and Description |
---|---|
void |
addCreateInstance(javassist.ClassPool classPool,
StringBuffer sb,
String className) |
protected void |
addImport(javassist.ClassPool classPool,
Class<?> cls) |
protected void |
addImport(javassist.ClassPool classPool,
String className) |
protected void |
appendSemicolon(StringBuffer sb) |
protected SrcAssignment |
assign(SrcExpression left,
SrcExpression right) |
static String |
classNameForClassType(NamedClassType namedType,
Map<com.whitestein.lsps.model.ProcessModel,String> hashMappings)
Returns name of generated class for named type.
|
static String |
classNameForFunction(FunctionSignature signature,
Map<com.whitestein.lsps.model.ProcessModel,String> hashMappings)
Returns name of generated class for function.
|
static String |
classNameForModule(String moduleName,
String moduleHash)
Returns name of generated class for module.
|
static String |
classNameForProcessModel(com.whitestein.lsps.model.ProcessModel model,
Map<com.whitestein.lsps.model.ProcessModel,String> hashMappings)
Returns name of generated class for process model.
|
protected List<javassist.CtClass> |
closureClasses() |
String |
compileClosure(javassist.ClassPool classPool,
javassist.CtClass cls,
javassist.CtClass moduleCls,
ClosureExpression expression,
ClosureOrigin expressionOrigin,
CommonCompiler.JavaTypesResolver javaTypeResolver,
boolean isInRecord,
boolean isInForm,
boolean isStatic)
Used to compile closures
|
protected SrcConstant |
constant(Object value) |
protected SrcExpression |
createMethodBody(javassist.ClassPool classPool,
javassist.CtClass cls,
javassist.CtClass moduleCls,
RecordType recordType,
FunctionSignature signature,
boolean isInForm) |
protected SrcMethod |
createPrivateMethod(javassist.ClassPool classPool,
javassist.CtClass cls,
javassist.CtClass moduleCls,
boolean isInRecord,
boolean isInForm,
Type returnType,
String methodName,
Expression exp,
ExpressionOrigin expressionOrigin,
List<LocalParameter> params,
CommonCompiler.JavaTypesResolver javaTypeResolver,
SrcExpression namespaceExp) |
protected SrcMethod |
createPrivateMethod(javassist.ClassPool classPool,
javassist.CtClass cls,
javassist.CtClass moduleCls,
SrcMethod method) |
protected boolean |
generateClass() |
protected boolean |
generateSource() |
static Class<?> |
getArrayClassForType(Type type,
Map<FreeType,Type> freeTypeBounds,
Map<ClassType,String> recordClassNames) |
static String |
getArrayClassNameForType(Type type,
Map<FreeType,Type> freeTypeBounds,
Map<ClassType,String> recordClassNames) |
static Type |
getBoundType(Type type,
Map<FreeType,Type> freeTypeBounds,
Map<ClassType,String> recordClassNames) |
static Class<?> |
getClassForType(Type type,
Map<FreeType,Type> freeTypeBounds,
Map<ClassType,String> recordClassNames) |
protected static ClassLoader |
getClassLoader() |
static String |
getClassNameForType(Type type,
Map<FreeType,Type> freeTypeBounds,
Map<ClassType,String> recordClassNames) |
List<Class<?>> |
getExceptionTypes(String className,
String methodName,
FunctionSignature signature) |
static String |
getFunctionName(FunctionSignature signature) |
protected String |
getModuleName() |
protected static ProtectionDomain |
getProtectionDomain() |
static String |
getSimpleClassNameForType(Type type,
Map<FreeType,Type> freeTypeBounds,
Map<ClassType,String> recordClassNames) |
boolean |
hasExecutionContextParameter(String className,
String methodName,
List<Class<?>> list,
boolean isVariadic) |
protected String |
lineSeparator() |
protected SrcMethodCall |
methodCall(SrcExpression object,
String methodName,
SrcExpression... params) |
protected SrcMethodCall |
methodCall(String methodName,
SrcExpression... params) |
static long |
nextIdx() |
protected SrcClass |
srcClass() |
protected SrcStringConstant |
strConstant(String value) |
protected SrcVariable |
var(String name) |
protected SrcVariableDef |
varDef(String type,
String name,
SrcExpression value) |
public static final String COMPILE_NAME
protected Map<FunctionSignature,String> formNames
public CommonCompiler(boolean generateClass, boolean generateSource, SrcClass srcClass, Map<com.whitestein.lsps.model.ProcessModel,String> hashMappings, Map<ClassType,String> classNames, Map<FunctionSignature,String> formNames)
generateClass
- generateSource
- srcClass
- hashMappings
- classNames
- formNames
- public static long nextIdx()
public static String classNameForProcessModel(com.whitestein.lsps.model.ProcessModel model, Map<com.whitestein.lsps.model.ProcessModel,String> hashMappings)
model
- hashMappings
- public static String classNameForModule(String moduleName, String moduleHash)
moduleName
- moduleHash
- public static String classNameForClassType(NamedClassType namedType, Map<com.whitestein.lsps.model.ProcessModel,String> hashMappings)
namedType
- hashMappings
- public static String classNameForFunction(FunctionSignature signature, Map<com.whitestein.lsps.model.ProcessModel,String> hashMappings)
signature
- hashMappings
- protected String getModuleName()
protected boolean generateClass()
protected boolean generateSource()
protected SrcClass srcClass()
protected String lineSeparator()
protected List<javassist.CtClass> closureClasses()
public static Type getBoundType(Type type, Map<FreeType,Type> freeTypeBounds, Map<ClassType,String> recordClassNames)
public static Class<?> getClassForType(Type type, Map<FreeType,Type> freeTypeBounds, Map<ClassType,String> recordClassNames)
public static String getArrayClassNameForType(Type type, Map<FreeType,Type> freeTypeBounds, Map<ClassType,String> recordClassNames)
public static Class<?> getArrayClassForType(Type type, Map<FreeType,Type> freeTypeBounds, Map<ClassType,String> recordClassNames)
public static String getClassNameForType(Type type, Map<FreeType,Type> freeTypeBounds, Map<ClassType,String> recordClassNames)
public static String getSimpleClassNameForType(Type type, Map<FreeType,Type> freeTypeBounds, Map<ClassType,String> recordClassNames)
public static String getFunctionName(FunctionSignature signature)
protected static ClassLoader getClassLoader()
protected static ProtectionDomain getProtectionDomain()
protected SrcVariableDef varDef(String type, String name, SrcExpression value)
protected SrcVariable var(String name)
protected SrcConstant constant(Object value)
protected SrcStringConstant strConstant(String value)
protected SrcAssignment assign(SrcExpression left, SrcExpression right)
protected SrcMethodCall methodCall(SrcExpression object, String methodName, SrcExpression... params)
protected SrcMethodCall methodCall(String methodName, SrcExpression... params)
protected SrcMethod createPrivateMethod(javassist.ClassPool classPool, javassist.CtClass cls, javassist.CtClass moduleCls, boolean isInRecord, boolean isInForm, Type returnType, String methodName, Expression exp, ExpressionOrigin expressionOrigin, List<LocalParameter> params, CommonCompiler.JavaTypesResolver javaTypeResolver, SrcExpression namespaceExp)
protected SrcMethod createPrivateMethod(javassist.ClassPool classPool, javassist.CtClass cls, javassist.CtClass moduleCls, SrcMethod method)
protected SrcExpression createMethodBody(javassist.ClassPool classPool, javassist.CtClass cls, javassist.CtClass moduleCls, RecordType recordType, FunctionSignature signature, boolean isInForm)
protected void addImport(javassist.ClassPool classPool, Class<?> cls)
protected void addImport(javassist.ClassPool classPool, String className)
public boolean hasExecutionContextParameter(String className, String methodName, List<Class<?>> list, boolean isVariadic)
public List<Class<?>> getExceptionTypes(String className, String methodName, FunctionSignature signature)
public void addCreateInstance(javassist.ClassPool classPool, StringBuffer sb, String className)
protected void appendSemicolon(StringBuffer sb)
public String compileClosure(javassist.ClassPool classPool, javassist.CtClass cls, javassist.CtClass moduleCls, ClosureExpression expression, ClosureOrigin expressionOrigin, CommonCompiler.JavaTypesResolver javaTypeResolver, boolean isInRecord, boolean isInForm, boolean isStatic) throws javassist.CannotCompileException, javassist.NotFoundException
cls
- classPool
- moduleCls
- expression
- expressionOrigin
- javaTypeResolver
- isInRecord
- isInForm
- javassist.CannotCompileException
javassist.NotFoundException
Copyright © 2007-2020 Whitestein Technologies. All Rights Reserved.