Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 10 Next »

In one and the same logic, say a pricing logic, I can refer to a constant (e.g. parameter name) in previous elements like this:

  • Assume there is an element 'Params' defined as
    • PARAM_PE = "PE"
    • PARAM_MARGIN = "Margin"
    • etc.
  • Further down in the logic, params are looked up in something like
    • ...getParameter(Params.PARAM_PE)...

This works since the static strings defined in the Params element are accessible from subsequent elements in the same logic. However, if Params was defined in a Groovy library – not an unusual use case if the parameter names are to be shared across multiple logics – then the above scheme no longer works.

There is, however a way to make it work.  Say you define a Groovy library named 'PO'.  Within that library you define a Params element, but this time you define the static parameter names as:

  • @Field PARAM_PE = "PE"
  • @Field PARAM_MARGIN = "Margin"
  • etc.

Then you can refer to those parameter names in ordinary logics with libs.PO.Params.PARAM_PE etc.

  • No labels