Package 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 Object implements ICodeFactory
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.eclipse.ease.ICodeFactory
ICodeFactory.Parameter
-
Field Summary
Fields Modifier and Type Field Description static String
LINE_DELIMITER
Default line break character.Fields inherited from interface org.eclipse.ease.ICodeFactory
RESULT_NAME, TRACE_MODULE_WRAPPER
-
Constructor Summary
Constructors Constructor Description AbstractCodeFactory()
-
Method Summary
Modifier and Type Method Description 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
createWrapper(IEnvironment environment, Object instance, String identifier, boolean customNamespace, IScriptEngine engine)
Create script wrapper code for a given java instance.String
getDefaultValue(ICodeFactory.Parameter parameter)
Get the default value for a given parameter.static Collection<String>
getMethodAliases(Method method)
static Collection<String>
getMethodNames(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 Details
-
LINE_DELIMITER
Default line break character.
-
-
Constructor Details
-
AbstractCodeFactory
public AbstractCodeFactory()
-
-
Method Details
-
getDefaultValue
Description copied from interface:ICodeFactory
Get the default value for a given parameter.- Specified by:
getDefaultValue
in interfaceICodeFactory
- Parameters:
parameter
- parameter to get default value for- Returns:
- String representation of default value
-
getMethodNames
-
getMethodAliases
-
createFunctionCall
Description copied from interface:ICodeFactory
Create code to call a wrapped function.- Specified by:
createFunctionCall
in interfaceICodeFactory
- Parameters:
method
- method to be calledparameters
- call parameters- Returns:
- script code to call function
-
createCommentedString
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 interfaceICodeFactory
- Parameters:
comment
- the commentaddBlockComment
-true
for adding block comment orfalse
for 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:ICodeFactory
Create script wrapper code for a given java instance.- Specified by:
createWrapper
in interfaceICodeFactory
- 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
-