Class Param<T>
java.lang.Object
io.nosqlbench.nb.api.config.standard.Param<T>
- Type Parameters:
T- The type of value which can be stored in this named configuration parameter in in actual configuration data.
public class Param<T>
extends java.lang.Object
A configuration element describes a single configurable parameter.
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classParam.CheckResult<T> -
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and Type Method Description static <V> Param<V>defaultTo(java.lang.String name, V defaultValue)Parameters which are given a default value are automatically marked as required, as the default value allows them to be accessed as such.static <V> Param<V>defaultTo(java.lang.String name, V defaultValue, java.lang.String description)Parameters which are given a default value are automatically marked as required, as the default value allows them to be accessed as such.static <V> Param<V>defaultTo(java.util.List<java.lang.String> names, V defaultValue)Parameters which are given a default value are automatically marked as required, as the default value allows them to be accessed as such.TgetDefaultValue()java.lang.StringgetDescription()java.util.List<java.lang.String>getNames()java.util.regex.PatterngetRegex()java.lang.Class<?>getType()booleanisRequired()static Param<java.lang.String>optional(java.lang.String name)Declare an optional String parameter with the given name.static <V> Param<V>optional(java.lang.String name, java.lang.Class<V> type)Declare an optional parameter for the given name which must be assignable to (returnable as) the specified type.static <V> Param<V>optional(java.lang.String name, java.lang.Class<V> type, java.lang.String description)Declare an optional parameter for the given name which must be assignable to (returnable as) the specified type.static Param<java.lang.String>optional(java.util.List<java.lang.String> names)Declare an optional String parameter specified by any of the names.static <V> Param<V>optional(java.util.List<java.lang.String> names, java.lang.Class<V> type)Declare an optional parameter specified by any of the names which must be assignable to (returnable as) the specified type.static <V> Param<V>optional(java.util.List<java.lang.String> names, java.lang.Class<V> type, java.lang.String description)Declare an optional parameter specified by any of the names which must be assignable to (returnable as) the specified type.static <V> Param<V>required(java.lang.String name, java.lang.Class<V> type)static <V> Param<V>required(java.util.List<java.lang.String> names, java.lang.Class<V> type)Param<T>setDescription(java.lang.String description)Param<T>setRegex(java.lang.String pattern)Param<T>setRegex(java.util.regex.Pattern regex)Param<?>setRequired(boolean required)java.lang.StringtoString()Param.CheckResult<T>validate(java.lang.Object value)
-
Field Details
-
Constructor Details
-
Method Details
-
optional
Declare an optional String parameter with the given name.- Parameters:
name- the name of the parameter
-
optional
Declare an optional String parameter specified by any of the names. They act as synonyms. When users provide more than one of these in configuration data, it is considered an error.- Parameters:
names- one or more names that the parameter can be specified with.
-
optional
public static <V> Param<V> optional(java.util.List<java.lang.String> names, java.lang.Class<V> type)Declare an optional parameter specified by any of the names which must be assignable to (returnable as) the specified type. When users provide more than one of these in configuration data, it is considered an error.- Type Parameters:
V- Generic type for inference.- Parameters:
names- one or more names that the parameter can be specified with.type- The type of value that the provided configuration value must be returnable as (assignable to)
-
optional
public static <V> Param<V> optional(java.util.List<java.lang.String> names, java.lang.Class<V> type, java.lang.String description)Declare an optional parameter specified by any of the names which must be assignable to (returnable as) the specified type. When users provide more than one of these in configuration data, it is considered an error.- Type Parameters:
V- Generic type for inference.- Parameters:
names- one or more names that the parameter can be specified with.type- The type of value that the provided configuration value must be returnable as (assignable to)description- A description of what this parameter is
-
optional
Declare an optional parameter for the given name which must be assignable to (returnable as) the specified type. When users provide more than one of these in configuration data, it is considered an error.- Type Parameters:
V- Generic type for inference.- Parameters:
name- the name of the parametertype- The type of value that the provided configuration value must be returnable as (assignable to)
-
optional
public static <V> Param<V> optional(java.lang.String name, java.lang.Class<V> type, java.lang.String description)Declare an optional parameter for the given name which must be assignable to (returnable as) the specified type. When users provide more than one of these in configuration data, it is considered an error.- Type Parameters:
V- Generic type for inference.- Parameters:
name- the name of the parametertype- The type of value that the provided configuration value must be returnable as (assignable to)description- A description of what this parameter is
-
defaultTo
Parameters which are given a default value are automatically marked as required, as the default value allows them to be accessed as such.- Type Parameters:
V-- Parameters:
name-defaultValue-- Returns:
-
defaultTo
public static <V> Param<V> defaultTo(java.lang.String name, V defaultValue, java.lang.String description)Parameters which are given a default value are automatically marked as required, as the default value allows them to be accessed as such.- Type Parameters:
V-- Parameters:
name-defaultValue-- Returns:
-
defaultTo
Parameters which are given a default value are automatically marked as required, as the default value allows them to be accessed as such.- Type Parameters:
V-- Parameters:
names-defaultValue-- Returns:
-
required
-
required
public static <V> Param<V> required(java.util.List<java.lang.String> names, java.lang.Class<V> type) -
toString
public java.lang.String toString()- Overrides:
toStringin classjava.lang.Object
-
getNames
public java.util.List<java.lang.String> getNames() -
getType
public java.lang.Class<?> getType() -
getDescription
public java.lang.String getDescription() -
isRequired
public boolean isRequired() -
setRequired
-
getDefaultValue
-
setDescription
-
setRegex
-
setRegex
-
getRegex
public java.util.regex.Pattern getRegex() -
validate
-