Class Config
- java.lang.Object
-
- com.tangosol.coherence.config.Config
-
public abstract class Config extends Object
Configis 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 withtansogol.prepended and lastly by replacing thecoherence.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 Config()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleangetBoolean(String sName)Returns true if coherence system propertysNameexists and value is equal to string true.static booleangetBoolean(String sName, boolean fDefault)Return true if propertysNameexists and its value is string true.static DoublegetDouble(String sName)Return Coherence system property value as a Double.static DoublegetDouble(String sName, double dDefault)Return Coherence system property value as a double.static com.oracle.coherence.common.util.DurationgetDuration(String sName)Return Coherence system property value as aDuration.static com.oracle.coherence.common.util.DurationgetDuration(String sName, com.oracle.coherence.common.util.Duration dDefault)Return Coherence system property value as aDuration.static Stringgetenv(String sName)Coherence enhanced system environment getter Use instead ofSystem.getenv(String).static FloatgetFloat(String sName)Return Coherence system property value as a Float.static FloatgetFloat(String sName, float fDefault)Return Coherence system property value as a float.static IntegergetInteger(String sName)Return Coherence system property value as an Integer.static IntegergetInteger(String sName, int iDefault)Return Coherence system property value as an Integer.static LonggetLong(String sName)Return Coherence system property value as a Long.static LonggetLong(String sName, long lDefault)Return Coherence system property value as a long.static com.oracle.coherence.common.util.MemorySizegetMemorySize(String sName)Return Coherence system property value as aMemorySize.static com.oracle.coherence.common.util.MemorySizegetMemorySize(String sName, String sDefault)Return Coherence system property value as aMemorySize.static StringgetProperty(String sName)Get the value of Coherence propertysNamestatic StringgetProperty(String sName, String sDefault)Get a Coherence property value, return default if property lookup fails.static StringgetProperty(String sName, Supplier<String> supDefault)Get a Coherence property value, returning the value provided by the supplier if property lookup fails.
-
-
-
Method Detail
-
getProperty
public static String getProperty(String sName)
Get the value of Coherence propertysNameThis implementation differs from
System.getProperty(String)that aSecurityExceptionis 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 withcoherence.- Returns:
- value of property
sNameor 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 withcoherence.sDefault- default value returned if property lookup fails- Returns:
- value of property
sName, orsDefaultif 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 withcoherence.supDefault- the supplier that provides a default value if property lookup fails- Returns:
- value of property
sName, or value provided by thesupDefaultif property lookup fails or no property defined
-
getBoolean
public static boolean getBoolean(String sName)
Returns true if coherence system propertysNameexists and value is equal to string true.Backwards compatibility support is described in
Config.- Parameters:
sName- Coherence system property name beginning withcoherence.- Returns:
trueif system property exists and equal to true
-
getBoolean
public static boolean getBoolean(String sName, boolean fDefault)
Return true if propertysNameexists and its value is string true.Backwards compatibility support is described in
Config.- Parameters:
sName- Coherence system property name beginning withcoherence.fDefault- default value if property value lookup or conversion fails.- Returns:
- true if
sNameexists and its value is string true; otherwise, returnsDefault.
-
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 withcoherence.- 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 withcoherence.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 withcoherence.- 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 withcoherence.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 withcoherence.- 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 withcoherence.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 withcoherence.- 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 withcoherence.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 aDuration.Backwards compatibility support is described in
Config.- Parameters:
sName- Coherence system property name beginning withcoherence.- Returns:
- property value as
Durationif property lookup and conversion of the String value toDurationsucceeds; 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 aDuration.Backwards compatibility support is described in
Config.- Parameters:
sName- Coherence system property name beginning withcoherence.dDefault- defaultDurationvalue- Returns:
- property value as
Durationif property lookup and conversion of the String value toDurationsucceeds; otherwise, returndDefault
-
getMemorySize
public static com.oracle.coherence.common.util.MemorySize getMemorySize(String sName)
Return Coherence system property value as aMemorySize.Backwards compatibility support is described in
Config.- Parameters:
sName- Coherence system property name beginning withcoherence.- Returns:
- property value as
MemorySizeif property lookup and conversion of the String value toMemorySizesucceeds; 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 aMemorySize.Backwards compatibility support is described in
Config.- Parameters:
sName- Coherence system property name beginning withcoherence.sDefault- defaultMemorySizevalue as string- Returns:
- property value as
MemorySizeif property lookup and conversion of the String value toMemorySizesucceeds; otherwise, return the specified default - Since:
- 23.09
-
getenv
public static String getenv(String sName)
Coherence enhanced system environment getter Use instead ofSystem.getenv(String).- Parameters:
sName- Coherence system environment property name- Returns:
- value for system environment property if it exists or null
-
-