InterfaceEnum

Java, Groovy, Python, JavaScript and TypeScript

In the case of Ge­ne­ra­tion Vari­ant 1 (Interface and Rules Module) a separate method is created as standard for each individual condition and action value, the name of which is dynamically formed from the respective titles and symbols.

If conditions or actions have many values, interfaces with a corresponding number of methods are created which must all be implemented and maintained.

With the keys InterfaceEnum and InterfaceParm, only one method is ge­ne­ra­ted for selected conditions or actions, in which the values are transferred either as enum or as parameters.

In the following chapters, these generation variants are called Enum and Parm generation.

Enums

ide.<ProgrammingLanguage>.InterfaceEnum[.n]

This generation parameter can be used to generate an enum for selected conditions and actions, so that instead of many methods for all values, only one method with an enum as a parameter is ge­ne­ra­ted:

  • The interface methods are called isEnum (…​) or doEnum (…​) by default

  • The name of the enum is formed dynamically from the title of the respective condition or action

  • An enum constant $nnn is ge­ne­ra­ted for each value in the table of values, where nnn is the number of the value

Parameter

ide.<ProgrammingLanguage>.InterfaceParm[.n]

With this generation parameter, only one method with the defined parameter list is generated for selected conditions and actions, instead of multiple methods for all values.

  • InterfaceParm ist only available for Java and Groovy

  • The use of enums has proven to be significantly more powerful, so the parameter-based variant is no longer being further developed

  • It is recommended that enum variants are used

Data extraction

The properties of enums and the parameters of parameter lists are specified using optional arguments, for example:

  • the symbol, the title or the text of the condition or action value as a string

  • a numerical value or a list of numbers that are read directly from the symbol or the title of the value du­ring generation

  • min and max value of an interval specification that is read directly from the symbol or the title of the value du­ring generation

  • etc.

Entry in an LFET.Project.ini-file:
ide.Java.InterfaceEnum.1: Symbol = Double; Title
ide.Java.InterfaceEnum.2: Symbol; Title = DoubleList
Entry in an LFET.Project.yaml-file:
ide.Java:
  Enabled: true

  Interface:

    Enum:
      1:
        Symbol: Double
        Title: '""'
      2:
        Symbol: '""'
        Title: DoubleList

The following chapters describe options that are available for InterfaceEnum generation.