Interface PropertiesHelper


  • public interface PropertiesHelper
    Provide utility methods to use property easily.
    Author:
    Grégory Van den Borre.
    • 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.