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
`static java.util.List<java.lang.String>` `RESERVED_KEYWORDS`

### Fields inherited from class org.eclipse.ease.AbstractCodeFactory

`LINE_DELIMITER`

### Fields inherited from interface org.eclipse.ease.ICodeFactory

`RESULT_NAME, TRACE_MODULE_WRAPPER`

### Constructor Summary

Constructors
Constructor and Description
`JavaScriptCodeFactory()`

### Method Summary

All Methods Instance Methods Concrete Methods
`java.lang.String` `classInstantiation(java.lang.Class<?> clazz, java.lang.String[] parameters)` Create code to instantiate a java class.
`java.lang.String` `createCommentedString(java.lang.String comment, boolean addBlockComment)` Create code for the provided comment.
`java.lang.String` `createWrapper(IEnvironment environment, java.lang.Object instance, java.lang.String identifier, boolean customNamespace, IScriptEngine engine)` Create script wrapper code for a given java instance.
`java.lang.String` `getSaveVariableName(java.lang.String variableName)` Converts a given string to a save variable name for the target language.

### Methods inherited from class org.eclipse.ease.AbstractCodeFactory

`createFunctionCall, createKeywordHeader, getDefaultValue, getMethodAliases, getMethodNames`

### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### RESERVED_KEYWORDS

    public static java.util.List<java.lang.String> RESERVED_KEYWORDS

### Constructor Detail

#### JavaScriptCodeFactory

    public JavaScriptCodeFactory()

### Method Detail

#### classInstantiation

    public java.lang.String classInstantiation(java.lang.Class<?> clazz,
                                               java.lang.String[] parameters)

Description copied from interface: `ICodeFactory`
Create code to instantiate a java class.

Parameters:
  `clazz` - class to instantiate
  `parameters` - parameters used for class instantiation
Returns:
  wrapped script code

#### getSaveVariableName

    public java.lang.String getSaveVariableName(java.lang.String variableName)

Description copied from interface: `ICodeFactory`
Converts 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

    public java.lang.String createCommentedString(java.lang.String comment,
                                                  boolean addBlockComment)

Description copied from interface: `ICodeFactory`
Create 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:
  `createCommentedString` in interface `ICodeFactory`
Overrides:
  `createCommentedString` in class `AbstractCodeFactory`
Parameters:
  `comment` - the comment
  `addBlockComment` - `true` for adding block comment or `false` for adding (multiple) line comments
Returns:
  the comment string with comment tokens.

#### createWrapper

    public java.lang.String createWrapper(IEnvironment environment,
                                          java.lang.Object instance,
                                          java.lang.String identifier,
                                          boolean customNamespace,
                                          IScriptEngine engine)

Description copied from interface: `ICodeFactory`
Create script wrapper code for a given java instance.

Specified by:
  `createWrapper` in interface `ICodeFactory`
Overrides:
  `createWrapper` in class `AbstractCodeFactory`
Parameters:
  `environment` - environment module instance
  `instance` - object instance to wrap
  `identifier` - script variable name for wrapped Java object
  `customNamespace` - whether to store methods to the global namespace or to create a custom object
  `engine` - script engine