Interface ParameterInfo

All Known Implementing Classes:
AbstractParameterInfo, ComputedParameterInfo, ListParameterInfo, MapParameterInfo, SetParameterInfo

public interface ParameterInfo
Represents the parameter of Pattern defines acceptable value of parameter value during matching. For example type, filter on attribute values.
  • Field Details

  • Method Details

    • getName

      String getName()
      the full name of the parameter from the root of parameter container to the value represented by this ParameterInfo
    • addValueAs

      @Nullable ImmutableMap addValueAs(ImmutableMap parameters, Object value)
      Matches `value` into `parameters` under the name/structure defined by this ParameterInfo. 1) checks that value matches with optional internal rules of this ParameterInfo 2) creates new copy of ImmutableMap which contains the new `value` and returns that copy
      parameters - the existing parameters
      value - the new, to be stored value
      copy of `parameters` with new value or existing `parameters` if value is already there or null if value doesn't fit into these parameters
    • getValueAs

      <T> void getValueAs(Factory factory, ResultHolder<T> result, ImmutableMap parameters)
      Takes the value of parameter identified by this ParameterInfo from the `parameters` and adds that 0, 1 or more values into result (depending on type of result)
      factory - the factory used to create new entities if conversion of value is needed before it can be added into `result`
      result - the receiver of the result value. It defined required type of returned value and multiplicity of returned value
      parameters - here are stored all the parameter values
    • isMultiple

      boolean isMultiple()
      true if the value container has to be a List, otherwise the container will be a single value
    • getParameterValueType

      Class<?> getParameterValueType()
      a type of parameter value - if known Note: Pattern builder needs to know the value type to be able to select substitute node. For example patter: return _expression_.S(); either replaces only `_expression_.S()` if the parameter value is an expression or replaces `return _expression_.S()` if the parameter value is a CtBlock
    • getMatchingStrategy

      Quantifier getMatchingStrategy()
      the strategy used to resolve conflict between two RootNodes
    • isRepeatable

      boolean isRepeatable()
      true if this matcher can be applied more then once in the same container of targets Note: even if false, it may be applied again to another container and to match EQUAL value
    • isMandatory

      boolean isMandatory(ImmutableMap parameters)
      parameters - matching parameters
      true if the ValueResolver of this parameter MUST match with next target in the state defined by current `parameters`. false if match is optional
    • isTryNextMatch

      boolean isTryNextMatch(ImmutableMap parameters)
      parameters - matching parameters
      true if the ValueResolver of this parameter should be processed again to match next target in the state defined by current `parameters`.