org.eclipse.ease

## Class AbstractCodeFactory

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

All Implemented Interfaces:
  ICodeFactory

Direct Known Subclasses:
  JavaScriptCodeFactory, PythonCodeFactory

    public abstract class AbstractCodeFactory
    extends Object
    implements ICodeFactory

### Nested Class Summary

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

`ICodeFactory.Parameter`

### Field Summary

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

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

`TRACE_MODULE_WRAPPER`

### Constructor Summary

Constructors
Constructor and Description
`AbstractCodeFactory()`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`String` `createCommentedString(String comment)` Provide a default implementation that adds a single line comment token to the beginning of each line of the comment.
`String` `createCommentedString(String comment, boolean addBlockComment)` Create code for the provided comment.
`String` `createFunctionCall(Method method, Object... parameters)` Create code to call a wrapped function.
`String` `createKeywordHeader(Map<String,String> keywords, String existingHeader)` Create a comment header for given keywords.
`String` `getDefaultValue(ICodeFactory.Parameter parameter)` Get the default value for a given parameter
`static Collection<String>` `getMethodNames(Method method)`
`static String` `getPostExecutionCode(IEnvironment environment, Method method)`
`static String` `getPreExecutionCode(IEnvironment environment, 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, createFinalFieldWrapper, createFunctionWrapper, getSaveVariableName`

### Field Detail

#### LINE_DELIMITER

    public static final String LINE_DELIMITER

Default line break character.

### Constructor Detail

#### AbstractCodeFactory

    public AbstractCodeFactory()

### Method Detail

#### createKeywordHeader

    public String createKeywordHeader(Map<String,String> keywords,
                                      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 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 Collection<String> getMethodNames(Method method)

#### getPreExecutionCode

    public static String getPreExecutionCode(IEnvironment environment,
                                             Method method)

#### getPostExecutionCode

    public static String getPostExecutionCode(IEnvironment environment,
                                              Method method)

#### createFunctionCall

    public String createFunctionCall(Method method,
                                     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 `ICodeFactory.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 String createCommentedString(String comment)

Provide a default implementation that adds a single line comment token to the beginning of each line of the comment. Extenders can override `getSingleLineCommentToken()` to return that token.

Specified by:
  `createCommentedString` in interface `ICodeFactory`
Parameters:
  `comment` - the comment
Returns:
  the comment with comment tokens.

#### createCommentedString

    public String createCommentedString(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 single line comment
Returns:
  the comment with comment tokens.