public class HazelcastProperties extends Object
HazelcastProperty
).
A HazelcastProperty
can be set as:
System.setProperty(String, String)
Config.setProperty(String, String)
Constructor and Description |
---|
HazelcastProperties(Config config)
Creates a container with configured Hazelcast properties.
|
HazelcastProperties(Properties nullableProperties)
Creates a container with configured Hazelcast properties.
|
Modifier and Type | Method and Description |
---|---|
boolean |
containsKey(HazelcastProperty property)
Returns true if value for given key is provided (either as a HazelcastProperty or a System property).
|
String |
get(String key)
Returns the value for the given key.
|
boolean |
getBoolean(HazelcastProperty property)
Returns the configured boolean value of a
HazelcastProperty . |
protected Config |
getConfig() |
double |
getDouble(HazelcastProperty property)
Returns the configured double value of a
HazelcastProperty . |
<E extends Enum> |
getEnum(HazelcastProperty property,
Class<E> enumClazz)
Returns the configured enum value of a
ClusterProperty . |
float |
getFloat(HazelcastProperty property)
Returns the configured float value of a
HazelcastProperty . |
int |
getInteger(HazelcastProperty property)
Returns the configured int value of a
HazelcastProperty . |
long |
getLong(HazelcastProperty property)
Returns the configured long value of a
HazelcastProperty . |
long |
getMillis(HazelcastProperty property)
Returns the configured value of a
HazelcastProperty converted to milliseconds. |
long |
getNanos(HazelcastProperty property)
Returns the configured value of a
HazelcastProperty converted to nanoseconds. |
long |
getPositiveMillisOrDefault(HazelcastProperty property)
Returns the configured value of a
HazelcastProperty converted to milliseconds if
it is positive, otherwise returns its default value. |
long |
getPositiveMillisOrDefault(HazelcastProperty property,
long defaultValue)
Returns the configured value of a
HazelcastProperty converted to milliseconds if
it is positive, otherwise returns the passed default value. |
int |
getSeconds(HazelcastProperty property)
Returns the configured value of a
HazelcastProperty converted to seconds. |
String |
getString(HazelcastProperty property)
Returns the configured value of a
HazelcastProperty as String. |
Set<String> |
keySet()
Returns an immutable set of all keys in this HazelcastProperties.
|
public HazelcastProperties(Config config)
Uses the system property value if no value is defined in the configuration. Uses the default value if no system property value is defined.
config
- Config
used to configure the HazelcastProperty
values;
properties in config are allowed to be null
public HazelcastProperties(Properties nullableProperties)
Uses the system property value if no value is defined in the configuration. Uses the default value if no system property value is defined.
nullableProperties
- Properties
used to configure the HazelcastProperty
values;
properties are allowed to be null
protected Config getConfig()
public Set<String> keySet()
public String get(String key)
HazelcastProperties
object is initialized with a
"compromised" Properties
object (ie one where keys/values of types
other than String
have been inserted), then get
on String
keys
mapped to non-String
values will return null
,
similarly to Properties.getProperty(String)
.key
- the keynull
if no value is foundNullPointerException
- if key is null
public String getString(HazelcastProperty property)
HazelcastProperty
as String.property
- the HazelcastProperty
to get the value fromnull
if nothing has been configuredpublic boolean containsKey(HazelcastProperty property)
property
- the HazelcastProperty
to checktrue
if the value was explicitly providedpublic boolean getBoolean(HazelcastProperty property)
HazelcastProperty
.property
- the HazelcastProperty
to get the value frompublic int getInteger(HazelcastProperty property)
HazelcastProperty
.property
- the HazelcastProperty
to get the value fromNumberFormatException
- if the value cannot be parsedpublic long getLong(HazelcastProperty property)
HazelcastProperty
.property
- the HazelcastProperty
to get the value fromNumberFormatException
- if the value cannot be parsedpublic float getFloat(HazelcastProperty property)
HazelcastProperty
.property
- the HazelcastProperty
to get the value fromNumberFormatException
- if the value cannot be parsedpublic double getDouble(HazelcastProperty property)
HazelcastProperty
.property
- the HazelcastProperty
to get the value fromNumberFormatException
- if the value cannot be parsedpublic long getNanos(HazelcastProperty property)
HazelcastProperty
converted to nanoseconds.property
- the HazelcastProperty
to get the value fromIllegalArgumentException
- if the HazelcastProperty
has no TimeUnit
public long getMillis(HazelcastProperty property)
HazelcastProperty
converted to milliseconds.property
- the HazelcastProperty
to get the value fromIllegalArgumentException
- if the HazelcastProperty
has no TimeUnit
public long getPositiveMillisOrDefault(HazelcastProperty property)
HazelcastProperty
converted to milliseconds if
it is positive, otherwise returns its default value.property
- the HazelcastProperty
to get the value fromIllegalArgumentException
- if the HazelcastProperty
has no TimeUnit
public long getPositiveMillisOrDefault(HazelcastProperty property, long defaultValue)
HazelcastProperty
converted to milliseconds if
it is positive, otherwise returns the passed default value.property
- the HazelcastProperty
to get the value fromdefaultValue
- the default value to return if property has non positive value.IllegalArgumentException
- if the HazelcastProperty
has no TimeUnit
public int getSeconds(HazelcastProperty property)
HazelcastProperty
converted to seconds.property
- the HazelcastProperty
to get the value fromIllegalArgumentException
- if the HazelcastProperty
has no TimeUnit
public <E extends Enum> E getEnum(HazelcastProperty property, Class<E> enumClazz)
ClusterProperty
.
The case of the enum is ignored.
E
- the enum typeproperty
- the ClusterProperty
to get the value fromIllegalArgumentException
- if the enum value can't be foundCopyright © 2024 Hazelcast, Inc.. All rights reserved.