Class VtlRule

    • Constructor Detail

      • VtlRule

        protected VtlRule​(Def def,
                          Script parent)
        Creates a new VTL rule mapper.
        Parameters:
        def - the VTL definition
        parent - the script parent
    • Method Detail

      • getReturnType

        public TypeDescriptor<?> getReturnType()
        Description copied from interface: IResolvableOperation
        Returns the return type of this operation.
        Returns:
        the return type
      • getParameterCount

        public int getParameterCount()
        Description copied from interface: IParameterizable
        Get the number of parameters of this rule.
        Returns:
        The number of parameters of this rule.
      • getParameter

        public VariableDeclaration getParameter​(int index)
        Description copied from interface: IParameterizable
        Get the parameter of this rule at the specified index.
        Parameters:
        index - The 0-based index of the rule parameter to be returned.
        Returns:
        The rule parameter at the given index.
      • getRequiredParameterCount

        public int getRequiredParameterCount()
        Description copied from interface: IParameterizable
        Returns the number of required parameters, i.e., non-default and non-named parameters.
        Returns:
        the number of required parameters
      • getParameter

        public VariableDeclaration getParameter​(java.lang.String name)
        Description copied from interface: IParameterizable
        Returns a named parameter declaration.
        Parameters:
        name - the name of the parameter
        Returns:
        the declaration or null if there is none
      • isStatic

        public boolean isStatic()
        Description copied from interface: IMetaOperation
        Returns whether this operation is static.
        Returns:
        true if it is static, false else
      • isFirstParameterOperand

        public boolean isFirstParameterOperand()
        Description copied from interface: IMetaOperation
        Returns whether the first parameter is the operand.
        Returns:
        true if the first parameter is the operand, false else
      • getParameterType

        public IMetaType getParameterType​(int index)
        Description copied from interface: IMetaOperation
        Returns the specified parameter type.
        Parameters:
        index - the index of the parameter to return
        Returns:
        the specified parameter type
      • getJavaSignature

        public java.lang.String getJavaSignature()
        Description copied from interface: IMetaOperation
        Returns the java-like signature of this operation.
        Returns:
        the java-like Java signature of this operation
      • getSignature

        public java.lang.String getSignature()
        Description copied from interface: IMetaOperation
        Returns the signature of the method (in terms of VIL types where possible).
        Returns:
        the signature of the method
      • acceptsNamedParameters

        public boolean acceptsNamedParameters()
        Description copied from interface: IMetaOperation
        Returns whether the operation accepts named parameters.
        Returns:
        true if it accepts named parameters, false else
      • getDeclaringType

        public IMetaType getDeclaringType()
        Description copied from interface: IMetaOperation
        Returns the declaring type.
        Returns:
        the declaring type (may be null in case of a wrapped external Java method)
      • isPlaceholder

        public boolean isPlaceholder()
        Description copied from interface: IMetaOperation
        Returns whether this operation is valid or whether it is a placeholder operation in case that the original operation cannot be resolved but the script shall remain executable.
        Returns:
        true if this operation is a placeholder, false else
      • isCompatible

        public IMetaOperation.CompatibilityResult isCompatible​(java.lang.Class<?> retType,
                                                               java.lang.Object... params)
        Description copied from interface: IMetaOperation
        Returns whether the operation represented by this instance is compatible to the given return type and parameters. This method does not consider possible unnamed parameter rather than the underlying Java parameter.
        Parameters:
        retType - the return type (may be null in order to ignore this parameter)
        params - the parameters (may be null if there are none, may be classes)
        Returns:
        an instance of IMetaOperation.CompatibilityResult denoting the actual compatibility level
      • getStringValue

        public java.lang.String getStringValue​(IStringValueProvider.StringComparator comparator)
        Description copied from interface: IStringValueProvider
        Returns the string value of this object.
        Parameters:
        comparator - if the sequence of elements, e.g., in case of collections, shall be ordered according to the comparator, null if the original sequence shall be returned
        Returns:
        the string value
      • isVirtual

        public boolean isVirtual()
        Description copied from interface: IRuleBlock
        Returns whether this block is a real block or consists just of a block element without brackets.
        Returns:
        true if this block is virtual, false else
      • returnActualValue

        public boolean returnActualValue()
        Description copied from interface: IRuleBlock
        Returns whether this body shall return an actual value (function) or a rule execution result.
        Returns:
        true in case of an actual value, false else
      • accept

        public java.lang.Object accept​(IVisitor visitor)
                                throws VilException
        Description copied from interface: IBuildlangElement
        Accepts the visitor for visiting.
        Parameters:
        visitor - the visitor to be used
        Returns:
        the result of visiting this instance (may be null)
        Throws:
        VilException - in case that visiting fails (e.g., execution)
      • getRuleConditionCount

        public int getRuleConditionCount​(Rule.Side side)
        Description copied from class: AbstractRule
        Get the number of match conditions on the given side of this rule.
        Specified by:
        getRuleConditionCount in class AbstractRule
        Parameters:
        side - the side (LHS, RHS)
        Returns:
        The number of preconditions (match conditions) of this rule.
      • getRuleCondition

        public AbstractRuleMatchExpression getRuleCondition​(Rule.Side side,
                                                            int index)
        Description copied from class: AbstractRule
        Get the match conditions of this rule on the given side at the specified index.
        Specified by:
        getRuleCondition in class AbstractRule
        Parameters:
        side - the side (LHS, RHS)
        index - The 0-based index of the match condition to be returned.
        Returns:
        The match condition at the given index.
      • hasCondition

        public boolean hasCondition​(Rule.Side side)
        Description copied from class: AbstractRule
        Returns whether the specified side has either rule calls or a matching condition.
        Specified by:
        hasCondition in class AbstractRule
        Parameters:
        side - the side (LHS, RHS)
        Returns:
        whether the specified side has cinditions at all
      • getRuleCallCount

        public int getRuleCallCount​(Rule.Side side)
        Description copied from class: AbstractRule
        Get the number of rule calls on the given side of this rule.
        Specified by:
        getRuleCallCount in class AbstractRule
        Parameters:
        side - the side (LHS, RHS)
        Returns:
        The number of postconditions of this rule.
      • getRuleCall

        public RuleCallExpression getRuleCall​(Rule.Side side,
                                              int index)
        Description copied from class: AbstractRule
        Get the rule call on the given side of this rule at the specified index.
        Specified by:
        getRuleCall in class AbstractRule
        Parameters:
        side - the side (LHS, RHS)
        index - The 0-based index of the rule element to be returned.
        Returns:
        The rule element at the given index.
      • isProtected

        public boolean isProtected()
        Description copied from class: AbstractRule
        Returns whether a rule is declared as protected regarding its visibility.
        Specified by:
        isProtected in class AbstractRule
        Returns:
        true if it is protected, false else
      • appendCallTo

        public void appendCallTo​(AbstractRule target,
                                 boolean qualifiedCall)
                          throws VilException
        Appends a call to target to the rule body. Currently, this method considers parameters only in the sequence of the parameters of this rule.
        Specified by:
        appendCallTo in class AbstractRule
        Parameters:
        target - the rule to append the call to
        qualifiedCall - insert a qualified call if true, an unqualified call if false
        Throws:
        VilException - in case that creating / resolving the rule call fails
      • getDef

        public Def getDef()
        Returns the def stored in this instance.
        Returns:
        the def