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 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 boolean
getBoolean(String sName)
Returns true if coherence system propertysName
exists and value is equal to string true.static boolean
getBoolean(String sName, boolean fDefault)
Return true if propertysName
exists and its value is string true.static Double
getDouble(String sName)
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
getDuration(String sName)
Return Coherence system property value as aDuration
.static com.oracle.coherence.common.util.Duration
getDuration(String sName, com.oracle.coherence.common.util.Duration dDefault)
Return Coherence system property value as aDuration
.static String
getenv(String sName)
Coherence enhanced system environment getter Use instead ofSystem.getenv(String)
.static Float
getFloat(String sName)
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
getInteger(String sName)
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
getMemorySize(String sName)
Return Coherence system property value as aMemorySize
.static com.oracle.coherence.common.util.MemorySize
getMemorySize(String sName, String sDefault)
Return Coherence system property value as aMemorySize
.static String
getProperty(String sName)
Get the value of Coherence propertysName
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.
-
-
-
Method Detail
-
getProperty
public static String getProperty(String sName)
Get the value of Coherence propertysName
This implementation differs from
System.getProperty(String)
that aSecurityException
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 withcoherence.
- 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 withcoherence.
sDefault
- default value returned if property lookup fails- Returns:
- value of property
sName
, orsDefault
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 withcoherence.
supDefault
- the supplier that provides a default value if property lookup fails- Returns:
- value of property
sName
, or value provided by thesupDefault
if property lookup fails or no property defined
-
getBoolean
public static boolean getBoolean(String sName)
Returns true if coherence system propertysName
exists and value is equal to string true.Backwards compatibility support is described in
Config
.- Parameters:
sName
- Coherence system property name beginning withcoherence.
- Returns:
true
if system property exists and equal to true
-
getBoolean
public static boolean getBoolean(String sName, boolean fDefault)
Return true if propertysName
exists 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
sName
exists 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
Duration
if property lookup and conversion of the String value toDuration
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 aDuration
.Backwards compatibility support is described in
Config
.- Parameters:
sName
- Coherence system property name beginning withcoherence.
dDefault
- defaultDuration
value- Returns:
- property value as
Duration
if property lookup and conversion of the String value toDuration
succeeds; 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
MemorySize
if property lookup and conversion of the String value toMemorySize
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 aMemorySize
.Backwards compatibility support is described in
Config
.- Parameters:
sName
- Coherence system property name beginning withcoherence.
sDefault
- defaultMemorySize
value as string- Returns:
- property value as
MemorySize
if property lookup and conversion of the String value toMemorySize
succeeds; 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
-
-