Class CascadeDecoder
java.lang.Object
org.smartparam.engine.core.decoder.StandardDecoder
pl.decerto.hyperon.runtime.decoder.CascadeDecoder
- All Implemented Interfaces:
ValueDecoder
Decoder that is used internally to decode and call Higson parameters and functions.
- Author:
- przemek hertel
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncascadeCall(String functionCode, ParamContext ctx) calls function usingHyperonEnginethat was passed in constructorcascadeCall(String functionCode, Type<?> type, ParamContext ctx) calls function usingHyperonEnginethat was passed in constructor.cascadeGet(String parameterCode, ParamContext ctx) invokes parameter usingHyperonEnginethat was passed in constructorcascadeGet(String parameterCode, Type<?> type, ParamContext ctx) invokes parameter usingHyperonEnginethat was passed in constructor.cascadeGetMultiValues(String parameterCode, ParamContext ctx) invokes parameter usingHyperonEnginethat was passed in constructordecode(String text, Type<?> type, ParamContext ctx) decodes giventextto specificValueHolder.
-
Constructor Details
-
CascadeDecoder
defauld cascade constructor- Parameters:
engine- Implementation ofHyperonEnginethat is used to call decoded parameters and functions
-
-
Method Details
-
decode
decodes giventextto specificValueHolder. If text contains special prefixes $f or $p then function/parameter code is extracted from text and called usingHyperonEngine. If text does NOT contain special prefixes, then decoding is passed toStandardDecoder.decode(String, Type, ParamContext)- Specified by:
decodein interfaceValueDecoder- Overrides:
decodein classStandardDecoder- Parameters:
text- contains value to decode, for example:- simple text
- 1234
- 2018-01-15 09:10:11
- $f hyperon.test.function
- $p hyperon.test.param
type- implementation ofTypethat will be used to convert result of parameter/function (if text contains special prefixes $f or $p) or simple value fromtextargumentctx- implementation ofParamContextthat is passed to parameter/function invocation- Returns:
- specific implementation of
ValueHoldercontaining decoded value - See Also:
-
cascadeCall
calls function usingHyperonEnginethat was passed in constructor- Parameters:
functionCode- cascade function code (without $f) that will be called. Code examples:- hyperon.example.fun
- hyperon.example.fun(1, 2)
- hyperon.example.fun(ctx:policy.insurer.age, 7)
ctx- implementation ofParamContextthat is passed to function invocation- Returns:
- raw result of function invocation
- See Also:
-
cascadeCall
calls function usingHyperonEnginethat was passed in constructor. If function result is a simple type then it is converted to specificValueHolderfrom passedtype- Parameters:
functionCode- cascade function code (without $f) that will be called. Code examples:- hyperon.example.fun
- hyperon.example.fun(1, 2)
- hyperon.example.fun(ctx:policy.insurer.age, 7)
type- implementation ofTypethat will be used to convert function result if returned object is simple typectx- implementation ofParamContextthat is passed to function invocation- Returns:
- converted result of function invocation, if function returns simple value, raw function result otherwise
- See Also:
-
cascadeGet
invokes parameter usingHyperonEnginethat was passed in constructor. If parameter result is a simple type then it is converted to specificValueHolderfrom passedtype- Parameters:
parameterCode- cascade parameter code (without $p) that will be invoked. Code examples:- hyperon.example.param
- hyperon.example.param[1]
- hyperon.example.param[factor]
type- implementation ofTypethat will be used to convert parameter result if returned object is simple typectx- implementation ofParamContextthat is passed to parameter invocation- Returns:
- converted result of parameter invocation, if parameter returns simple value, raw parameter result otherwise
- See Also:
-
cascadeGet
invokes parameter usingHyperonEnginethat was passed in constructor- Parameters:
parameterCode- cascade parameter code (without $p) that will be invoked. Code examples:- hyperon.example.param
- hyperon.example.param[1]
- hyperon.example.param[factor]
ctx- implementation ofParamContextthat is passed to parameter invocation- Returns:
- instance of
ValueHolder - See Also:
-
cascadeGetMultiValues
invokes parameter usingHyperonEnginethat was passed in constructor- Parameters:
parameterCode- cascade parameter code (without $p) that will be invoked. Code examples:- hyperon.example.param
- hyperon.example.param[1]
- hyperon.example.param[factor]
ctx- implementation ofParamContextthat is passed to parameter invocation- Returns:
- instance of
MultiValue - See Also:
-