Package io.cucumber.java
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
Author
is an example of the type of the parameter type.ParameterType.getType()
- See Also:
ParameterType
, Cucumber Expressions
-
-
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 aRegularExpression
.boolean
useForSnippets
Indicates whether or not this is a parameter type that should be used for generatingGeneratedExpression
s from text.
-
-
-
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 aRegularExpression
. 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 generatingGeneratedExpression
s 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
-
-