Class Config

java.lang.Object
com.tangosol.coherence.config.Config

public abstract class Config extends Object
Config is a helper class for processing a Coherence configuration system properties.

As of Coherence 12.2.1, all Coherence system properties start with coherence.. There is backwards compatibility support that if the property is not found, then the property is looked up again with tansogol. prepended and lastly by replacing the coherence. in the system property name to support Coherence system property naming conventions prior to Coherence 12.2.1.

Note: These methods should only be used when the system property name may begin with "coherence.*" or "tangosol.*". The native method for looking up a system or environment property should be used to lookup up a OS/Language native property.

Since:
Coherence 12.2.1
Author:
jf 2015.04.21
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    Returns true if coherence system property sName exists and value is equal to string true.
    static boolean
    getBoolean(String sName, boolean fDefault)
    Return true if property sName exists and its value is string true.
    static Double
    Return Coherence system property value as a Double.
    static Double
    getDouble(String sName, double dDefault)
    Return Coherence system property value as a double.
    static com.oracle.coherence.common.util.Duration
    Return Coherence system property value as a Duration.
    static com.oracle.coherence.common.util.Duration
    getDuration(String sName, com.oracle.coherence.common.util.Duration dDefault)
    Return Coherence system property value as a Duration.
    static String
    getenv(String sName)
    Coherence enhanced system environment getter Use instead of System.getenv(String).
    static Float
    Return Coherence system property value as a Float.
    static Float
    getFloat(String sName, float fDefault)
    Return Coherence system property value as a float.
    static Integer
    Return Coherence system property value as an Integer.
    static Integer
    getInteger(String sName, int iDefault)
    Return Coherence system property value as an Integer.
    static Long
    getLong(String sName)
    Return Coherence system property value as a Long.
    static Long
    getLong(String sName, long lDefault)
    Return Coherence system property value as a long.
    static com.oracle.coherence.common.util.MemorySize
    Return Coherence system property value as a MemorySize.
    static com.oracle.coherence.common.util.MemorySize
    getMemorySize(String sName, String sDefault)
    Return Coherence system property value as a MemorySize.
    static String
    Get the value of Coherence property sName
    static String
    getProperty(String sName, String sDefault)
    Get a Coherence property value, return default if property lookup fails.
    static String
    getProperty(String sName, Supplier<String> supDefault)
    Get a Coherence property value, returning the value provided by the supplier if property lookup fails.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Config

      public Config()
  • Method Details

    • getProperty

      public static String getProperty(String sName)
      Get the value of Coherence property sName

      This implementation differs from System.getProperty(String) that a SecurityException is handled and logged as a warning and null is returned as the property's value.

      Backwards compatibility support is described in Config.

      Parameters:
      sName - Coherence system property name beginning with coherence.
      Returns:
      value of property sName or null if property lookup fails or property does not exist
    • getProperty

      public static String getProperty(String sName, String sDefault)
      Get a Coherence property value, return default if property lookup fails.

      Backwards compatibility support is described in Config.

      Parameters:
      sName - Coherence system property name beginning with coherence.
      sDefault - default value returned if property lookup fails
      Returns:
      value of property sName, or sDefault if property lookup fails or no property defined
    • getProperty

      public static String getProperty(String sName, Supplier<String> supDefault)
      Get a Coherence property value, returning the value provided by the supplier if property lookup fails.

      Backwards compatibility support is described in Config.

      Parameters:
      sName - Coherence system property name beginning with coherence.
      supDefault - the supplier that provides a default value if property lookup fails
      Returns:
      value of property sName, or value provided by the supDefault if property lookup fails or no property defined
    • getBoolean

      public static boolean getBoolean(String sName)
      Returns true if coherence system property sName exists and value is equal to string true.

      Backwards compatibility support is described in Config.

      Parameters:
      sName - Coherence system property name beginning with coherence.
      Returns:
      true if system property exists and equal to true
    • getBoolean

      public static boolean getBoolean(String sName, boolean fDefault)
      Return true if property sName exists and its value is string true.

      Backwards compatibility support is described in Config.

      Parameters:
      sName - Coherence system property name beginning with coherence.
      fDefault - default value if property value lookup or conversion fails.
      Returns:
      true if sName exists and its value is string true; otherwise, return sDefault.
    • getInteger

      public static Integer getInteger(String sName)
      Return Coherence system property value as an Integer.

      Backwards compatibility support is described in Config.

      Parameters:
      sName - Coherence system property name beginning with coherence.
      Returns:
      property value as integer if property lookup and conversion of the String value to integer succeeds; otherwise, return null
    • getInteger

      public static Integer getInteger(String sName, int iDefault)
      Return Coherence system property value as an Integer.

      Backwards compatibility support is described in Config.

      Parameters:
      sName - Coherence system property name beginning with coherence.
      iDefault - integer default value
      Returns:
      property value as integer if property lookup and conversion of the String value to integer succeeds; otherwise, return iDefault
    • getLong

      public static Long getLong(String sName)
      Return Coherence system property value as a Long.

      Backwards compatibility support is described in Config.

      Parameters:
      sName - Coherence system property name beginning with coherence.
      Returns:
      property value as long if property lookup and conversion of the String value to long succeeds; otherwise, return null
    • getLong

      public static Long getLong(String sName, long lDefault)
      Return Coherence system property value as a long.

      Backwards compatibility support is described in Config.

      Parameters:
      sName - Coherence system property name beginning with coherence.
      lDefault - long default value
      Returns:
      property value as long if property lookup and conversion of the String value to long succeeds; otherwise, return lDefault
    • getFloat

      public static Float getFloat(String sName)
      Return Coherence system property value as a Float.

      Backwards compatibility support is described in Config.

      Parameters:
      sName - Coherence system property name beginning with coherence.
      Returns:
      property value as float if property lookup and conversion of the String value to float succeeds; otherwise, return null
    • getFloat

      public static Float getFloat(String sName, float fDefault)
      Return Coherence system property value as a float.

      Backwards compatibility support is described in Config.

      Parameters:
      sName - Coherence system property name beginning with coherence.
      fDefault - float default value
      Returns:
      property value as long if property lookup and conversion of the String value to float succeeds; otherwise, return fDefault
    • getDouble

      public static Double getDouble(String sName)
      Return Coherence system property value as a Double.

      Backwards compatibility support is described in Config.

      Parameters:
      sName - Coherence system property name beginning with coherence.
      Returns:
      property value as double if property lookup and conversion of the String value to double succeeds; otherwise, return null
    • getDouble

      public static Double getDouble(String sName, double dDefault)
      Return Coherence system property value as a double.

      Backwards compatibility support is described in Config.

      Parameters:
      sName - Coherence system property name beginning with coherence.
      dDefault - double default value
      Returns:
      property value as double if property lookup and conversion of the String value to double succeeds; otherwise, return dDefault
    • getDuration

      public static com.oracle.coherence.common.util.Duration getDuration(String sName)
      Return Coherence system property value as a Duration.

      Backwards compatibility support is described in Config.

      Parameters:
      sName - Coherence system property name beginning with coherence.
      Returns:
      property value as Duration if property lookup and conversion of the String value to Duration succeeds; otherwise, return null
    • getDuration

      public static com.oracle.coherence.common.util.Duration getDuration(String sName, com.oracle.coherence.common.util.Duration dDefault)
      Return Coherence system property value as a Duration.

      Backwards compatibility support is described in Config.

      Parameters:
      sName - Coherence system property name beginning with coherence.
      dDefault - default Duration value
      Returns:
      property value as Duration if property lookup and conversion of the String value to Duration succeeds; otherwise, return dDefault
    • getMemorySize

      public static com.oracle.coherence.common.util.MemorySize getMemorySize(String sName)
      Return Coherence system property value as a MemorySize.

      Backwards compatibility support is described in Config.

      Parameters:
      sName - Coherence system property name beginning with coherence.
      Returns:
      property value as MemorySize if property lookup and conversion of the String value to MemorySize succeeds; otherwise, return null
      Since:
      23.09
    • getMemorySize

      public static com.oracle.coherence.common.util.MemorySize getMemorySize(String sName, String sDefault)
      Return Coherence system property value as a MemorySize.

      Backwards compatibility support is described in Config.

      Parameters:
      sName - Coherence system property name beginning with coherence.
      sDefault - default MemorySize value as string
      Returns:
      property value as MemorySize if property lookup and conversion of the String value to MemorySize succeeds; otherwise, return the specified default
      Since:
      23.09
    • getenv

      public static String getenv(String sName)
      Coherence enhanced system environment getter Use instead of System.getenv(String).
      Parameters:
      sName - Coherence system environment property name
      Returns:
      value for system environment property if it exists or null