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 StringLINE_DELIMITERDefault 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 StringcreateCommentedString(String comment, boolean addBlockComment)Create code for the provided comment.StringcreateFunctionCall(Method method, Object... parameters)Create code to call a wrapped function.StringcreateWrapper(IEnvironment environment, Object instance, String identifier, boolean customNamespace, IScriptEngine engine)Create script wrapper code for a given java instance.StringgetDefaultValue(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, waitMethods 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:ICodeFactoryGet the default value for a given parameter.- Specified by:
getDefaultValuein interfaceICodeFactory- Parameters:
parameter- parameter to get default value for- Returns:
- String representation of default value
-
getMethodNames
-
getMethodAliases
-
createFunctionCall
Description copied from interface:ICodeFactoryCreate code to call a wrapped function.- Specified by:
createFunctionCallin interfaceICodeFactory- Parameters:
method- method to be calledparameters- call parameters- Returns:
- script code to call function
-
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- 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- 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
-