Class PropertiesUtil

java.lang.Object
com.atlassian.jira.config.properties.PropertiesUtil

public class PropertiesUtil extends Object
  • Method Details

    • getIntProperty

      public static int getIntProperty(ApplicationProperties applicationProperties, String propertyKey, int defaultValue)
      Utility method for getting int parameters.

      Parses the defined application property to an int if possible. If the defined value is missing or invalid, then it logs an error and returns the given defaultValue instead.

      Parameters:
      applicationProperties - application properties
      propertyKey - property key
      defaultValue - The default value to use if we can't find an int for the given key.
      Returns:
      the int value for the given property key, or the default value if a valid value was not found.
    • getIntPropertyNoErrorLogIfUnavailableOrNotParsable

      public static int getIntPropertyNoErrorLogIfUnavailableOrNotParsable(ApplicationProperties applicationProperties, String propertyKey, int defaultValue)
      Utility method for getting int parameters.

      Parses the defined application property to an int if possible. If the defined value is missing or invalid, then it returns the given defaultValue instead.

      Parameters:
      applicationProperties - application properties
      propertyKey - property key
      defaultValue - The default value to use if we can't find an int for the given key.
      Returns:
      the int value for the given property key, or the default value if a valid value was not found.
    • getLongProperty

      public static long getLongProperty(ApplicationProperties applicationProperties, String propertyKey, long defaultValue)
      Utility method for getting long parameters.

      Parses the defined application property to an long if possible. If the defined value is missing or invalid, then it it logs an error and returns the given defaultValue instead.

      Parameters:
      applicationProperties - application properties
      propertyKey - property key
      defaultValue - The default value to use if we can't find an long for the given key.
      Returns:
      the long value for the given property key, or the default value if a valid value was not found.
    • getLongPropertyNoErrorLogIfUnavailableOrNotParsable

      public static long getLongPropertyNoErrorLogIfUnavailableOrNotParsable(ApplicationProperties applicationProperties, String propertyKey, long defaultValue)
      Utility method for getting long parameters.

      Parses the defined application property to an long if possible. If the defined value is missing or invalid, then it ret'urns the given defaultValue instead.

      Parameters:
      applicationProperties - application properties
      propertyKey - property key
      defaultValue - The default value to use if we can't find an long for the given key.
      Returns:
      the long value for the given property key, or the default value if a valid value was not found.
    • getLongPropertyInternal

      public static long getLongPropertyInternal(ApplicationProperties applicationProperties, String propertyKey, long defaultValue, boolean shouldLogError)
    • getDoubleProperty

      public static double getDoubleProperty(ApplicationProperties applicationProperties, String propertyKey, double defaultValue)
      Utility method for getting double parameters.

      Parses the defined application property to an double if possible. If the defined value is missing or invalid, then it logs an error and it returns the given defaultValue instead.

      Parameters:
      applicationProperties - application properties
      propertyKey - property key
      defaultValue - The default value to use if we can't find an double for the given key.
      Returns:
      the double value for the given property key, or the default value if a valid value was not found.
    • getDoublePropertyNoErrorLogIfUnavailableOrNotParsable

      public static double getDoublePropertyNoErrorLogIfUnavailableOrNotParsable(ApplicationProperties applicationProperties, String propertyKey, double defaultValue)
      Utility method for getting double parameters.

      Parses the defined application property to an double if possible. If the defined value is missing or invalid, then ir returns the given defaultValue instead.

      Parameters:
      applicationProperties - application properties
      propertyKey - property key
      defaultValue - The default value to use if we can't find an double for the given key.
      Returns:
      the double value for the given property key, or the default value if a valid value was not found.
    • getBooleanProperty

      public static boolean getBooleanProperty(ApplicationProperties applicationProperties, String propertyKey, boolean defaultValue)
      Utility method for getting parameters.

      Parses the defined application property to a boolean if possible. If the defined value is missing or invalid, then it returns the given defaultValue instead.

      Parameters:
      applicationProperties - application properties
      propertyKey - property key
      defaultValue - The default value to use if we can't find a boolean for the given key.
      Returns:
      the boolean value for the given property key, or the default value if a valid value was not found.