Package org.apache.hadoop.hbase.conf
Class ConfigKey
java.lang.Object
org.apache.hadoop.hbase.conf.ConfigKey
Utility class for basic validation of configuration values.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static interfaceprivate static interface -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final org.slf4j.Loggerprivate static final Map<String,ConfigKey.Validator> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringRegisters the configuration key that expects a boolean value.static <T> StringRegisters the configuration key that expects a class.static StringRegisters the configuration key that expects a double.static StringRegisters the configuration key that expects a float.static StringRegisters the configuration key that expects an integer.static StringRegisters the configuration key that expects a long.private static Stringregister(String key, ConfigKey.Validator validator) static voidvalidate(org.apache.hadoop.conf.Configuration conf) Validates the configuration.private static <T> voidvalidateNumeric(String name, String expected, ConfigKey.NumberGetter<T> getter, Predicate<T>... predicates)
-
Field Details
-
LOG
-
validators
-
-
Constructor Details
-
ConfigKey
private ConfigKey()
-
-
Method Details
-
INT
Registers the configuration key that expects an integer.- Parameters:
key- configuration keypredicates- additional predicates to validate the value- Returns:
- the key
-
LONG
Registers the configuration key that expects a long.- Parameters:
key- configuration keypredicates- additional predicates to validate the value- Returns:
- the key
-
FLOAT
Registers the configuration key that expects a float.- Parameters:
key- configuration keypredicates- additional predicates to validate the value- Returns:
- the key
-
DOUBLE
Registers the configuration key that expects a double.- Parameters:
key- configuration keypredicates- additional predicates to validate the value- Returns:
- the key
-
CLASS
Registers the configuration key that expects a class.- Parameters:
key- configuration keyexpected- the expected class or interface the value should implement- Returns:
- the key
-
BOOLEAN
Registers the configuration key that expects a boolean value. We actually don't register a validator, becauseConfiguration.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
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
-