Class PropertiesHelper

java.lang.Object
org.jppf.utils.configuration.PropertiesHelper

public class PropertiesHelper extends Object
Author:
Laurent Cohen
  • Constructor Details

    • PropertiesHelper

      public PropertiesHelper()
  • Method Details

    • store

      public static void store(Properties props, Writer writer) throws IOException
      Store the specified properties into the specified writer. This implementation stores the properties in lexicographic order (alphabetical sort).
      Parameters:
      props - the properties to store.
      writer - the writer to store with.
      Throws:
      IOException - if any error occurs.
    • toInt

      public static int toInt(String val, int defValue)
      Get the integer value of the specified string.
      Parameters:
      val - the string val to convert to an int.
      defValue - a default value to return if value is null.
      Returns:
      the value of the property as an int, or the default value if it is not found.
    • toLong

      public static long toLong(String val, long defValue)
      Get the long value of the specified string.
      Parameters:
      val - the string value to convert to a long.
      defValue - the default val to return if value is null.
      Returns:
      the value of the property a a long, or the default value if it is not found.
    • toFloat

      public static float toFloat(String val, float defValue)
      Get the float value of the specified string.
      Parameters:
      val - the string value to convert to a float.
      defValue - the default value to return if val is null.
      Returns:
      the value of the property a a float, or the default value if it is not found.
    • toDouble

      public static double toDouble(String val, double defValue)
      Get the double value of the specified string.
      Parameters:
      val - the string value to convert to a double.
      defValue - the default value to return if val is null.
      Returns:
      the value of the property a an double, or the default value if it is not found.
    • removeUnderscores

      public static String removeUnderscores(String source)
      Remove the underscore characters from the specfied string.
      Parameters:
      source - the string from whihc to remove the underscore characters.
      Returns:
      a new string stripped of underscore characters, or the source string if it doesn't have any underscore character.