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 interface
private static interface
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final org.slf4j.Logger
private static final Map<String,
ConfigKey.Validator> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String
Registers the configuration key that expects a boolean value.static <T> String
Registers the configuration key that expects a class.static String
Registers the configuration key that expects a double.static String
Registers the configuration key that expects a float.static String
Registers the configuration key that expects an integer.static String
Registers the configuration key that expects a long.private static String
register
(String key, ConfigKey.Validator validator) static void
validate
(org.apache.hadoop.conf.Configuration conf) Validates the configuration.private static <T> void
validateNumeric
(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
-