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 class  Param.CheckResult<T>  
  • Field Summary

    Fields 
    Modifier and Type Field Description
    boolean required  
    java.lang.Class<? extends T> type  
  • Constructor Summary

    Constructors 
    Constructor Description
    Param​(java.util.List<java.lang.String> names, java.lang.Class<? extends T> type, java.lang.String description, boolean required, T defaultValue)  
  • 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.
    T getDefaultValue()  
    java.lang.String getDescription()  
    java.util.List<java.lang.String> getNames()  
    java.util.regex.Pattern getRegex()  
    java.lang.Class<?> getType()  
    boolean isRequired()  
    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.String toString()  
    Param.CheckResult<T> validate​(java.lang.Object value)  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • type

      public final java.lang.Class<? extends T> type
    • required

      public boolean required
  • Constructor Details

    • Param

      public Param​(java.util.List<java.lang.String> names, java.lang.Class<? extends T> type, java.lang.String description, boolean required, T defaultValue)
  • Method Details

    • optional

      public static Param<java.lang.String> optional​(java.lang.String name)
      Declare an optional String parameter with the given name.
      Parameters:
      name - the name of the parameter
    • optional

      public static Param<java.lang.String> optional​(java.util.List<java.lang.String> names)
      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

      public 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. 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 parameter
      type - 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 parameter
      type - The type of value that the provided configuration value must be returnable as (assignable to)
      description - A description of what this parameter is
    • defaultTo

      public 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.
      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

      public 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.
      Type Parameters:
      V -
      Parameters:
      names -
      defaultValue -
      Returns:
    • required

      public static <V> Param<V> required​(java.lang.String name, java.lang.Class<V> type)
    • 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:
      toString in class java.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

      public Param<?> setRequired​(boolean required)
    • getDefaultValue

      public T getDefaultValue()
    • setDescription

      public Param<T> setDescription​(java.lang.String description)
    • setRegex

      public Param<T> setRegex​(java.util.regex.Pattern regex)
    • setRegex

      public Param<T> setRegex​(java.lang.String pattern)
    • getRegex

      public java.util.regex.Pattern getRegex()
    • validate

      public Param.CheckResult<T> validate​(java.lang.Object value)