Class ConfigKey

java.lang.Object
org.apache.hadoop.hbase.conf.ConfigKey

@Private public final class ConfigKey extends Object
Utility class for basic validation of configuration values.
  • Field Details

  • Constructor Details

  • Method Details

    • INT

      @SafeVarargs public static String INT(String key, Predicate<Integer>... predicates)
      Registers the configuration key that expects an integer.
      Parameters:
      key - configuration key
      predicates - additional predicates to validate the value
      Returns:
      the key
    • LONG

      @SafeVarargs public static String LONG(String key, Predicate<Long>... predicates)
      Registers the configuration key that expects a long.
      Parameters:
      key - configuration key
      predicates - additional predicates to validate the value
      Returns:
      the key
    • FLOAT

      @SafeVarargs public static String FLOAT(String key, Predicate<Float>... predicates)
      Registers the configuration key that expects a float.
      Parameters:
      key - configuration key
      predicates - additional predicates to validate the value
      Returns:
      the key
    • DOUBLE

      @SafeVarargs public static String DOUBLE(String key, Predicate<Double>... predicates)
      Registers the configuration key that expects a double.
      Parameters:
      key - configuration key
      predicates - additional predicates to validate the value
      Returns:
      the key
    • CLASS

      public static <T> String CLASS(String key, Class<T> expected)
      Registers the configuration key that expects a class.
      Parameters:
      key - configuration key
      expected - the expected class or interface the value should implement
      Returns:
      the key
    • BOOLEAN

      public static String BOOLEAN(String key)
      Registers the configuration key that expects a boolean value. We actually don't register a validator, because Configuration.getBoolean(java.lang.String, boolean) doesn't throw an exception even if the value is not a boolean. So this is only for documentation purposes.
      Parameters:
      key - configuration key
      Returns:
      the key
    • validate

      public static void validate(org.apache.hadoop.conf.Configuration conf)
      Validates the configuration.
      Parameters:
      conf - a configuration to validate
    • validateNumeric

      private static <T> void validateNumeric(String name, String expected, ConfigKey.NumberGetter<T> getter, Predicate<T>... predicates)
    • register

      private static String register(String key, ConfigKey.Validator validator)