Package be.yildizgames.common.properties
Interface PropertiesHelper
-
public interface PropertiesHelperProvide utility methods to use property easily.- Author:
- Grégory Van den Borre.
-
-
Method Summary
Static Methods Modifier and Type Method Description static booleangetBooleanValue(Properties properties, String key)Get a boolean value from a properties.static booleangetBooleanValue(Properties properties, String key, boolean defaultValue)Get a boolean value from a properties.static intgetIntValue(Properties properties, String key)Get a int value from a properties.static intgetPortValue(Properties properties, String s)static StringgetValue(Properties properties, String key)Get a String value from a properties.static voidkeyNotFoundError(String key)Error for a key not found.
-
-
-
Method Detail
-
getBooleanValue
static boolean getBooleanValue(Properties properties, String key)
Get a boolean value from a properties.- Parameters:
properties- Properties to extract the value.key- Key associated to the value.- Returns:
- The boolean value found.
- Throws:
be.yildizgames.common.properties.PropertiesException- If the key is not found.be.yildizgames.common.properties.PropertiesException- If the value cannot be parsed into a boolean.
-
getBooleanValue
static boolean getBooleanValue(Properties properties, String key, boolean defaultValue)
Get a boolean value from a properties.- Parameters:
properties- Properties to extract the value.key- Key associated to the value.defaultValue- Default value if it does not exists in the properties.- Returns:
- The boolean value found.
- Throws:
be.yildizgames.common.properties.PropertiesException- If the key is not found.be.yildizgames.common.properties.PropertiesException- If the value cannot be parsed into a boolean.
-
getIntValue
static int getIntValue(Properties properties, String key)
Get a int value from a properties.- Parameters:
properties- Properties to extract the value.key- Key associated to the value.- Returns:
- The integer value found.
- Throws:
be.yildizgames.common.properties.PropertiesException- If the key is not found.be.yildizgames.common.properties.PropertiesException- If the value cannot be parsed into a int.
-
getValue
static String getValue(Properties properties, String key)
Get a String value from a properties.- Parameters:
properties- Properties to extract the value.key- Key associated to the value.- Returns:
- The value found.
- Throws:
be.yildizgames.common.properties.PropertiesException- If the key is not found.
-
keyNotFoundError
static void keyNotFoundError(String key)
Error for a key not found.- Parameters:
key- Key not found.
-
getPortValue
static int getPortValue(Properties properties, String s)
-
-