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
  • Field Details

    • LINE_DELIMITER

      public static final String LINE_DELIMITER
      Default line break character.
  • Constructor Details

    • AbstractCodeFactory

      public AbstractCodeFactory()
  • Method Details

    • 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)
    • getMethodAliases

      public static Collection<String> getMethodAliases(Method method)
    • createFunctionCall

      public String createFunctionCall(Method method, Object... parameters)
      Description copied from interface: ICodeFactory
      Create code to call a wrapped function.
      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, 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 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 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
      Returns:
      create wrapped script code