org.eclipse.ease

## Class AbstractCodeFactory

- java.lang.Object
- - org.eclipse.ease.AbstractCodeFactory

All Implemented Interfaces:
  ICodeFactory

Direct Known Subclasses:
  GroovyCodeFactory, JavaScriptCodeFactory, PythonCodeFactory, RubyCodeFactory

    public abstract class AbstractCodeFactory
    extends java.lang.Object
    implements ICodeFactory

### Nested Class Summary

### Nested classes/interfaces inherited from interface org.eclipse.ease.ICodeFactory

`ICodeFactory.Parameter`

### Field Summary

Fields
`static java.lang.String` `LINE_DELIMITER` Default line break character.

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

`RESULT_NAME, TRACE_MODULE_WRAPPER`

### Constructor Summary

Constructors
Constructor and Description
`AbstractCodeFactory()`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`java.lang.String` `createCommentedString(java.lang.String comment, boolean addBlockComment)` Create code for the provided comment.
`java.lang.String` `createFunctionCall(java.lang.reflect.Method method, java.lang.Object... parameters)` Create code to call a wrapped function.
`java.lang.String` `createKeywordHeader(java.util.Map<java.lang.String,java.lang.String> keywords, java.lang.String existingHeader)` Create a comment header for given keywords.
`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` `getDefaultValue(ICodeFactory.Parameter parameter)` Get the default value for a given parameter
`static java.util.Collection<java.lang.String>` `getMethodAliases(java.lang.reflect.Method method)`
`static java.util.Collection<java.lang.String>` `getMethodNames(java.lang.reflect.Method method)`

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

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

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

`classInstantiation, getSaveVariableName`

### Field Detail

#### LINE_DELIMITER

    public static final java.lang.String LINE_DELIMITER

Default line break character.

### Constructor Detail

#### AbstractCodeFactory

    public AbstractCodeFactory()

### Method Detail

#### createKeywordHeader

    public java.lang.String createKeywordHeader(java.util.Map<java.lang.String,java.lang.String> keywords,
                                                java.lang.String existingHeader)

Description copied from interface: `ICodeFactory`
Create a comment header for given keywords. Arbitrary content will be delimited by an empty line

Specified by:
  `createKeywordHeader` in interface `ICodeFactory`
Parameters:
  `keywords` - key:value pairs to be stored
  `existingHeader` - current header to copy plain text from
Returns:
  String representation of header

#### getDefaultValue

    public java.lang.String getDefaultValue(ICodeFactory.Parameter parameter)

Description copied from interface: `ICodeFactory`
Get the default value for a given parameter

Specified by:
  `getDefaultValue` in interface `ICodeFactory`
Parameters:
  `parameter` - parameter to get default value for
Returns:
  String representation of default value

#### getMethodNames

    public static java.util.Collection<java.lang.String> getMethodNames(java.lang.reflect.Method method)

#### getMethodAliases

    public static java.util.Collection<java.lang.String> getMethodAliases(java.lang.reflect.Method method)

#### createFunctionCall

    public java.lang.String createFunctionCall(java.lang.reflect.Method method,
                                               java.lang.Object... parameters)

Description copied from interface: `ICodeFactory`
Create code to call a wrapped function. Create code to call a script function that was wrapped using `#createFunctionWrapper(IEnvironment, String, Method)` before.

Specified by:
  `createFunctionCall` in interface `ICodeFactory`
Parameters:
  `method` - method to be called
  `parameters` - call parameters
Returns:
  script code to call function

#### 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`
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`
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