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 |
createWrapper(IEnvironment environment,
Object instance,
String identifier,
boolean customNamespace,
IScriptEngine engine)
Create script wrapper code for a given java instance.
|
String |
getSaveVariableName(String variableName)
Converts a given string to a save variable name for the target language.
|
createFunctionCall, createKeywordHeader, getDefaultValue, getMethodAliases, getMethodNames, getPostExecutionCode, getPreExecutionCode
public String classInstantiation(Class<?> clazz, String[] parameters)
ICodeFactory
clazz
- class to instantiateparameters
- parameters used for class instantiationpublic 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 (multiple) line commentspublic String createWrapper(IEnvironment environment, Object instance, String identifier, boolean customNamespace, IScriptEngine engine)
ICodeFactory
createWrapper
in interface ICodeFactory
createWrapper
in class AbstractCodeFactory
environment
- environment module instanceinstance
- object instance to wrapidentifier
- script variable name for wrapped Java objectcustomNamespace
- whether to store methods to the global namespace or to create a custom objectengine
- script engine