Annotation Type Param


  • @Retention(RUNTIME)
    @Target(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
    • The command line, if specified using -Dname=value1,value2,value3
    • Otherwise, the value() list given in the annotation
    • Otherwise, if the parameter type is either boolean or an enum type, Caliper assumes you want all possible values.
    • Finally, if none of the above match, Caliper will display an error and exit.

    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

      Optional Elements 
      Modifier and Type Optional Element Description
      String[] value
      One or more default values, as strings, that this parameter should be given if none are specified on the command line.
    • Element Detail

      • value

        String[] value
        One or more default values, as strings, that this parameter should be given if none are specified on the command line. If values are specified on the command line, the defaults given here are all ignored.
        Default:
        {}