Class Config
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
-
Method Summary
Modifier and TypeMethodDescriptionstatic 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
Return Coherence system property value as a Double.static Double
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
Coherence enhanced system environment getter Use instead ofSystem.getenv(String)
.static Float
Return Coherence system property value as a Float.static Float
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
Return Coherence system property value as a Long.static Long
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.
-
Constructor Details
-
Config
public Config()
-
-
Method Details
-
getProperty
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
-