public class ConfigurationParserUtils extends Object
Configuration
and to
sanity check them.Constructor and Description |
---|
ConfigurationParserUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
checkConfigParameter(boolean condition,
Object parameter,
String name,
String errorMessage)
Validates a condition for a config parameter and displays a standard exception, if the
the condition does not hold.
|
static int |
getPageSize(Configuration configuration)
Parses the configuration to get the page size and validates the value.
|
static int |
getSlot(Configuration configuration)
Parses the configuration to get the number of slots and validates the value.
|
public static int getSlot(Configuration configuration)
configuration
- configuration objectpublic static void checkConfigParameter(boolean condition, Object parameter, String name, String errorMessage) throws IllegalConfigurationException
condition
- The condition that must hold. If the condition is false, an exception is thrown.parameter
- The parameter value. Will be shown in the exception message.name
- The name of the config parameter. Will be shown in the exception message.errorMessage
- The optional custom error message to append to the exception message.IllegalConfigurationException
- if the condition does not holdpublic static int getPageSize(Configuration configuration)
configuration
- configuration objectCopyright © 2014–2020 The Apache Software Foundation. All rights reserved.