Interface PropertyService

All Known Implementing Classes:
BeamlineConfigurationService

public interface PropertyService
A service for accessing properties.
  • Method Summary

    Modifier and Type
    Method
    Description
    default String
    get(String property)
    Get the value of a property as a String.
    boolean
    getAsBoolean(String property, boolean defaultValue)
    Get the value of a property as a boolean with a default.
    double
    getAsDouble(String property, double defaultValue)
    Get the value of a property as an double with a default.
    int
    getAsInt(String property, int defaultValue)
    Get the value of a property as an int with a default.
    default String
    getAsString(String property)
    Get the value of a property as a String.
    getAsString(String property, String defaultValue)
    Get the value of a property as a String with a default.
    boolean
    isSet(String property)
    Check if a property is set.
    void
    set(String property, String value)
    Deprecated, for removal: This API element is subject to removal in a future version.
    This is marked as deprecated to discourage new uses of this method.
  • Method Details

    • get

      default String get(String property)
      Get the value of a property as a String. Equivalent to getAsString(property, null)
      Parameters:
      property - The property to lookup
      Returns:
      The property value or null if not set
      See Also:
    • getAsString

      default String getAsString(String property)
      Get the value of a property as a String. Equivalent to getAsString(property, null)
      Parameters:
      property - The property to lookup
      Returns:
      The property value or null if not set
      See Also:
    • getAsString

      String getAsString(String property, String defaultValue)
      Get the value of a property as a String with a default.
      Parameters:
      property - The property to lookup
      defaultValue - The value to return if the property is not set
      Returns:
      The property value or the defaultValue if not set
      See Also:
    • getAsInt

      int getAsInt(String property, int defaultValue)
      Get the value of a property as an int with a default. An attempt to convert the property value to an int will be made, if this fails the default will be returned.
      Parameters:
      property - The property to lookup
      defaultValue - The value to return if the property is not set
      Returns:
      The property value or the defaultValue if not set
    • getAsDouble

      double getAsDouble(String property, double defaultValue)
      Get the value of a property as an double with a default. An attempt to convert the property value to a double will be made, if this fails the default will be returned.
      Parameters:
      property - The property to lookup
      defaultValue - The value to return if the property is not set
      Returns:
      The property value or the defaultValue if not set
    • getAsBoolean

      boolean getAsBoolean(String property, boolean defaultValue)
      Get the value of a property as a boolean with a default. An attempt to convert the property value to a boolean will be made, if this fails the default will be returned.
      Parameters:
      property - The property to lookup
      defaultValue - The value to return if the property is not set
      Returns:
      The property value or the defaultValue if not set
    • isSet

      boolean isSet(String property)
      Check if a property is set.
      Parameters:
      property - The property to lookup
      Returns:
      true if the property is set, false otherwise
    • set

      @Deprecated(since="GDA 9.6", forRemoval=true) void set(String property, String value)
      Deprecated, for removal: This API element is subject to removal in a future version.
      This is marked as deprecated to discourage new uses of this method.
      Sets a property to the provided value. It will only be set for the life of the JVM, it will not be persisted to the property files.

      This method is provided to bridge support for existing code, new code should not set properties programmatically at runtime and support for this feature will be removed in the future.

      Parameters:
      property - The property to set
      value - The value to set the property to