Annotation Type ParameterType


  • @Retention(RUNTIME)
    @Target(METHOD)
    @API(status=STABLE)
    public @interface ParameterType
    Register parameter type.

    The name of the method is used as the name of the ParameterType.

    The method must have one of these signatures. The number of String parameters must match the number of capture groups in the regular expression.

    • String -> Author
    • String, String -> Author
    • String, String, ect -> Author
    • String... -> Author
    NOTE: Author is an example of the type of the parameter type. ParameterType.getType()
    See Also:
    ParameterType, Cucumber Expressions
    • Required Element Summary

      Required Elements 
      Modifier and Type Required Element Description
      String value
      Regular expression.
    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element Description
      String name
      Name of the parameter type.
      boolean preferForRegexMatch
      Indicates whether or not this is a preferential parameter type when matching text against a RegularExpression.
      boolean useForSnippets
      Indicates whether or not this is a parameter type that should be used for generating GeneratedExpressions from text.
      boolean useRegexpMatchAsStrongTypeHint
      Indicates whether or not this parameter provides a strong type hint when considering a regular expression match.
    • Element Detail

      • value

        String value
        Regular expression.

        Describes which patterns match this parameter type. If the expression includes capture groups their captured strings will be provided as individual arguments.

        Returns:
        a regular expression.
        See Also:
        ParameterType.getRegexps()
      • name

        String name
        Name of the parameter type.

        This is used as the type name in typed expressions. When not provided this will default to the name of the annotated method.

        Returns:
        human readable type name
        See Also:
        ParameterType.getName()
        Default:
        ""
      • preferForRegexMatch

        boolean preferForRegexMatch
        Indicates whether or not this is a preferential parameter type when matching text against a RegularExpression. In case there are multiple parameter types with a regexp identical to the capture group's regexp, a preferential parameter type will win. If there are more than 1 preferential ones, an error will be thrown.
        Returns:
        true if this is a preferential type
        See Also:
        ParameterType.preferForRegexpMatch()
        Default:
        false
      • useForSnippets

        boolean useForSnippets
        Indicates whether or not this is a parameter type that should be used for generating GeneratedExpressions from text. Typically, parameter types with greedy regexps should return false.
        Returns:
        true is this parameter type is used for expression generation
        See Also:
        ParameterType.useForSnippets()
        Default:
        false
      • useRegexpMatchAsStrongTypeHint

        boolean useRegexpMatchAsStrongTypeHint
        Indicates whether or not this parameter provides a strong type hint when considering a regular expression match. If so, the type hint provided by the method arguments will be ignored. If not, when both type hints are in agreement, this parameter type's transformer will be used. Otherwise parameter transformation for a regular expression match will be handled by DefaultParameterTransformer.
        Returns:
        true if this parameter type provides a type hint when considering a regular expression match
        Default:
        false