Package org.eclipse.ease.lang.javascript
Class JavaScriptCodeFactory
java.lang.Object
org.eclipse.ease.AbstractCodeFactory
org.eclipse.ease.lang.javascript.JavaScriptCodeFactory
- All Implemented Interfaces:
ICodeFactory
public class JavaScriptCodeFactory extends AbstractCodeFactory
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.eclipse.ease.ICodeFactory
ICodeFactory.Parameter -
Field Summary
Fields inherited from class org.eclipse.ease.AbstractCodeFactory
LINE_DELIMITERFields inherited from interface org.eclipse.ease.ICodeFactory
RESULT_NAME, TRACE_MODULE_WRAPPER -
Constructor Summary
Constructors Constructor Description JavaScriptCodeFactory() -
Method Summary
Modifier and Type Method Description StringclassInstantiation(Class<?> clazz, String[] parameters)Create code to instantiate a java class.StringcreateCommentedString(String comment, boolean addBlockComment)Create code for the provided comment.StringcreateWrapper(IEnvironment environment, Object instance, String identifier, boolean customNamespace, IScriptEngine engine)Create script wrapper code for a given java instance.StringgetSaveVariableName(String variableName)Converts a given string to a save variable name for the target language.static booleanisSaveName(String identifier)Methods inherited from class org.eclipse.ease.AbstractCodeFactory
createFunctionCall, getDefaultValue, getMethodAliases, getMethodNames
-
Constructor Details
-
JavaScriptCodeFactory
public JavaScriptCodeFactory()
-
-
Method Details
-
isSaveName
-
classInstantiation
Description copied from interface:ICodeFactoryCreate code to instantiate a java class.- Parameters:
clazz- class to instantiateparameters- parameters used for class instantiation- Returns:
- wrapped script code
-
getSaveVariableName
Description copied from interface:ICodeFactoryConverts a given string to a save variable name for the target language. Typically filters invalid characters and verifies that the returned string does not match any reserved keyword. Does not verify if the returned name is already in use.- Parameters:
variableName- variable name candidate- Returns:
- converted variable name
-
createCommentedString
Description copied from interface:ICodeFactoryCreate code for the provided comment. Typically line or block comment tokens will be added around the comment. Start block comment token will be added immediately before comment and end block comment token will be added immediately after comment. Format comment properly to get proper result.- Specified by:
createCommentedStringin interfaceICodeFactory- Overrides:
createCommentedStringin classAbstractCodeFactory- Parameters:
comment- the commentaddBlockComment-truefor adding block comment orfalsefor adding (multiple) line comments- Returns:
- the comment string with comment tokens.
-
createWrapper
public String createWrapper(IEnvironment environment, Object instance, String identifier, boolean customNamespace, IScriptEngine engine)Description copied from interface:ICodeFactoryCreate script wrapper code for a given java instance.- Specified by:
createWrapperin interfaceICodeFactory- Overrides:
createWrapperin classAbstractCodeFactory- Parameters:
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- Returns:
- create wrapped script code
-