public class JavaScriptCodeFactory extends AbstractCodeFactory
ICodeFactory.Parameter
Modifier and Type | Field and Description |
---|---|
static List<String> |
RESERVED_KEYWORDS |
LINE_DELIMITER
TRACE_MODULE_WRAPPER
Constructor and Description |
---|
JavaScriptCodeFactory() |
Modifier and Type | Method and Description |
---|---|
String |
classInstantiation(Class<?> clazz,
String[] parameters)
Create code to instantiate a java class.
|
String |
createCommentedString(String comment,
boolean addBlockComment)
Create code for the provided comment.
|
String |
createFinalFieldWrapper(IEnvironment environment,
String moduleVariable,
Field field)
Create code to bind a final java field to a script variable.
|
String |
createFunctionWrapper(IEnvironment environment,
String moduleVariable,
Method method)
Create code to wrap a java method call on a given script variable to the target language.
|
String |
getSaveVariableName(String variableName)
Converts a given string to a save variable name for the target language.
|
createCommentedString, createFunctionCall, createKeywordHeader, getDefaultValue, getMethodNames, getPostExecutionCode, getPreExecutionCode
public String classInstantiation(Class<?> clazz, String[] parameters)
ICodeFactory
clazz
- class to instantiateparameters
- parameters used for class instantiationpublic String createFunctionWrapper(IEnvironment environment, String moduleVariable, Method method)
ICodeFactory
environment
- script environmentmoduleVariable
- name of variable holding the module instancemethod
- method to be wrappedpublic String createFinalFieldWrapper(IEnvironment environment, String moduleVariable, Field field)
ICodeFactory
environment
- script environmentmoduleVariable
- name of variable holding the module instancefield
- field to be accessedpublic String getSaveVariableName(String variableName)
ICodeFactory
variableName
- variable name candidatepublic String createCommentedString(String comment, boolean addBlockComment)
ICodeFactory
createCommentedString
in interface ICodeFactory
createCommentedString
in class AbstractCodeFactory
comment
- the commentaddBlockComment
- true
for adding block comment or false
for adding single line comment