|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.hibernate.search.backend.configuration.ConfigurationParseHelper
public abstract class ConfigurationParseHelper
Helper class to avoid managing NumberFormatException and similar code and ensure consistent error messages across Configuration parsing problems.
Constructor Summary | |
---|---|
ConfigurationParseHelper()
|
Method Summary | |
---|---|
static boolean |
getBooleanValue(Properties cfg,
String key,
boolean defaultValue)
Extracts a boolean value from configuration properties |
static int |
getIntValue(Properties cfg,
String key,
int defValue)
Looks for a numeric value in the Properties, returning defValue if not found or if an empty string is found. |
static boolean |
parseBoolean(String value,
String errorMsgOnParseFailure)
Parses a string to recognize exactly either "true" or "false". |
static int |
parseInt(String value,
int defValue,
String errorMsgOnParseFailure)
In case value is null or an empty string the defValue is returned |
static int |
parseInt(String value,
String errorMsgOnParseFailure)
Parses a String to get an int value. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ConfigurationParseHelper()
Method Detail |
---|
public static final int parseInt(String value, String errorMsgOnParseFailure)
value
- A string containing an int value to parseerrorMsgOnParseFailure
- message being wrapped in a SearchException if value is null or not correct.
SearchException
- both for null values and for Strings not containing a valid int.public static final int parseInt(String value, int defValue, String errorMsgOnParseFailure)
value
- defValue
- errorMsgOnParseFailure
-
SearchException
- if value can't be parsed.public static final int getIntValue(Properties cfg, String key, int defValue)
cfg
- key
- defValue
-
SearchException
- for invalid format.public static final boolean parseBoolean(String value, String errorMsgOnParseFailure)
value
- the string to be parsederrorMsgOnParseFailure
- the message to be put in the exception if thrown
SearchException
- for invalid format or values.public static final boolean getBooleanValue(Properties cfg, String key, boolean defaultValue)
cfg
- configuration Propertieskey
- the property keydefaultValue
-
SearchException
- for invalid format or values.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |