|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT |
@Retention(value=RUNTIME) @Target(value=FIELD) public @interface Param
To make your benchmark depend on a parameterized value, create a field with the name you want this parameter to be known by, and add this annotation. Caliper will inject a value for this field to each instance it creates. These values come from
-Dname=value1,value2,value3
value()
list given in the annotation
paramName + "Values"
(for
example, if the parameter field is size
, it looks for sizeValues()
). The
method can return any subtype of Iterable
. The contents of that iterable are used as
the parameter values.
boolean
or an enum
type, Caliper
assumes you want all possible values.
Caliper parameters are always strings, but can be converted to other types at the point of
injection. If the type of the field this annotation is applied to is not String
, then the
type class must contain a static fromString(String)
, decode(String)
or valueOf(String)
method that returns that type, or a constructor accepting only a String
.
Caliper will test every possible combination of parameter values for your benchmark. For
example, if you have two parameters, -Dletter=a,b,c -Dnumber=1,2
, Caliper will construct
six independent "scenarios" and perform measurement for each one.
Optional Element Summary | |
---|---|
String[] |
value
One or more default values, as strings, that this parameter should be given if none are specified on the command line. |
public abstract String[] value
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT |