Class CascadeDecoder

All Implemented Interfaces:
ValueDecoder

public class CascadeDecoder extends StandardDecoder
Decoder that is used internally to decode and call Higson parameters and functions.
Author:
przemek hertel
  • Constructor Details

    • CascadeDecoder

      public CascadeDecoder(HigsonEngine engine)
      defauld cascade constructor
      Parameters:
      engine - Implementation of HigsonEngine that is used to call decoded parameters and functions
  • Method Details

    • decode

      public ValueHolder decode(String text, Type<?> type, ParamContext ctx)
      decodes given text to specific ValueHolder. If text contains special prefixes $f or $p then function/parameter code is extracted from text and called using HigsonEngine. If text does NOT contain special prefixes, then decoding is passed to StandardDecoder.decode(String, Type, ParamContext)
      Specified by:
      decode in interface ValueDecoder
      Overrides:
      decode in class StandardDecoder
      Parameters:
      text - contains value to decode, for example:
      • simple text
      • 1234
      • 2018-01-15 09:10:11
      • $f higson.test.function
      • $p higson.test.param
      • $u gt(path, 20)
      type - implementation of Type that will be used to convert result of parameter/function (if text contains special prefixes $f or $p) or simple value from text argument
      ctx - implementation of ParamContext that is passed to parameter/function invocation
      Returns:
      specific implementation of ValueHolder containing decoded value
      See Also:
    • cascadeCall

      public Object cascadeCall(String functionCode, ParamContext ctx)
      calls function using HigsonEngine that was passed in constructor
      Parameters:
      functionCode - cascade function code (without $f) that will be called. Code examples:
      • higson.example.fun
      • higson.example.fun(1, 2)
      • higson.example.fun(ctx:policy.insurer.age, 7)
      ctx - implementation of ParamContext that is passed to function invocation
      Returns:
      raw result of function invocation
      See Also:
    • cascadeFlowCall

      public Object cascadeFlowCall(String flowCode, ParamContext ctx)
      invokes flow using HigsonEngine that was passed in constructor.
      Parameters:
      flowCode - cascade parameter code (without $w) that will be invoked. Code examples:
      • higson.example.flow
      • higson.example.flow[flowKey]
      ctx - implementation of ParamContext that is passed to flow invocation
      Returns:
      result of flow invocation FlowResult or result of flow invocation for specific flowKey
      See Also:
      • (String, ParamContext)
    • cascadeUtilCall

      public Object cascadeUtilCall(String functionCode, ParamContext ctx)
    • cascadeCall

      public Object cascadeCall(String functionCode, Type<?> type, ParamContext ctx)
      calls function using HigsonEngine that was passed in constructor. If function result is a simple type then it is converted to specific ValueHolder from passed type
      Parameters:
      functionCode - cascade function code (without $f) that will be called. Code examples:
      • higson.example.fun
      • higson.example.fun(1, 2)
      • higson.example.fun(ctx:policy.insurer.age, 7)
      type - implementation of Type that will be used to convert function result if returned object is simple type
      ctx - implementation of ParamContext that is passed to function invocation
      Returns:
      converted result of function invocation, if function returns simple value, raw function result otherwise
      See Also:
    • cascadeGet

      public ValueHolder cascadeGet(String parameterCode, Type<?> type, ParamContext ctx)
      invokes parameter using HigsonEngine that was passed in constructor. If parameter result is a simple type then it is converted to specific ValueHolder from passed type
      Parameters:
      parameterCode - cascade parameter code (without $p) that will be invoked. Code examples:
      • higson.example.param
      • higson.example.param[1]
      • higson.example.param[factor]
      type - implementation of Type that will be used to convert parameter result if returned object is simple type
      ctx - implementation of ParamContext that is passed to parameter invocation
      Returns:
      converted result of parameter invocation, if parameter returns simple value, raw parameter result otherwise
      See Also:
    • cascadeGetHolder

      public ValueHolder cascadeGetHolder(String parameterCode, ParamContext ctx)
      invokes parameter using HigsonEngine that was passed in constructor and returns the holder of the selected output as it is, without converting it to any simple type. Useful for callers that store the value untyped.
      Parameters:
      parameterCode - cascade parameter code (without $p) that will be invoked. Code examples:
      • higson.example.param
      • higson.example.param[1]
      • higson.example.param[factor]
      ctx - implementation of ParamContext that is passed to parameter invocation
      Returns:
      instance of ValueHolder or null if the parameter returned no value
      See Also:
    • cascadeGet

      public ValueHolder[] cascadeGet(String parameterCode, ParamContext ctx)
      invokes parameter using HigsonEngine that was passed in constructor
      Parameters:
      parameterCode - cascade parameter code (without $p) that will be invoked. Code examples:
      • higson.example.param
      • higson.example.param[1]
      • higson.example.param[factor]
      ctx - implementation of ParamContext that is passed to parameter invocation
      Returns:
      instance of ValueHolder
      See Also:
    • cascadeGetMultiValues

      public MultiValue[] cascadeGetMultiValues(String parameterCode, ParamContext ctx)
      invokes parameter using HigsonEngine that was passed in constructor
      Parameters:
      parameterCode - cascade parameter code (without $p) that will be invoked. Code examples:
      • higson.example.param
      • higson.example.param[1]
      • higson.example.param[factor]
      ctx - implementation of ParamContext that is passed to parameter invocation
      Returns:
      instance of MultiValue
      See Also: