public class ConfigurationUtils extends Object
ConfigurationUtils
is a utility class to perform basic configuration-related
logic and is separated out here for easier, more direct testing.Constructor and Description |
---|
ConfigurationUtils(Map<String,?> configs) |
ConfigurationUtils(Map<String,?> configs,
String saslMechanism) |
Modifier and Type | Method and Description |
---|---|
<T> T |
get(String name) |
Path |
validateFile(String name)
Validates that, if a value is supplied, is a file that:
exists
has read permission
points to a file
If the value is null or an empty string, it is assumed to be an "empty" value and thus.
|
Integer |
validateInteger(String name,
boolean isRequired)
Validates that, if a value is supplied, is a value that:
is an Integer
has a value that is not less than the provided minimum value
If the value is null or an empty string, it is assumed to be an "empty" value and thus
ignored.
|
Long |
validateLong(String name)
Validates that, if a value is supplied, is a value that:
is an Integer
has a value that is not less than the provided minimum value
If the value is null or an empty string, it is assumed to be an "empty" value and thus
ignored.
|
Long |
validateLong(String name,
boolean isRequired) |
Long |
validateLong(String name,
boolean isRequired,
Long min) |
String |
validateString(String name) |
String |
validateString(String name,
boolean isRequired) |
URL |
validateUrl(String name)
Validates that the configured URL that:
is well-formed
contains a scheme
uses either HTTP, HTTPS, or file protocols
No effort is made to connect to the URL in the validation step.
|
public Path validateFile(String name)
public Integer validateInteger(String name, boolean isRequired)
public Long validateLong(String name)
public URL validateUrl(String name)
public String validateString(String name) throws ValidateException
ValidateException
public String validateString(String name, boolean isRequired) throws ValidateException
ValidateException
public <T> T get(String name)