T
- type of the SystemProperty
that is wrapped.public interface SystemProperty<T>
SystemProperty
is a thin wrapper around the java system properties
facility. It provides type-safe access to a system property and is aware of
the name of that property.Modifier and Type | Method and Description |
---|---|
void |
clear()
Removes the system property from the system property set.
|
String |
getName()
Returns the name of the system property that is wrapped by this
SystemProperty instance. |
T |
getValue()
Determines the value of the system property specified by
getName() . |
T |
getValue(T defaultValue)
Determines the value of the system property specified by
getName() . |
String |
setValue(T value)
Sets the system property specified by
getName() . |
T getValue()
getName()
.null
if the specified
system property was not found or the value could not be parsed.T getValue(T defaultValue)
getName()
.defaultValue
- will be returned if the specified system property was not
found.defaultValue
if the
specified system property was not found or the value could not be
parsed.String getName()
SystemProperty
instance.SystemProperty
instance.String setValue(T value) throws SecurityException, NullPointerException, IllegalArgumentException
getName()
.
First, if a security manager exists, its
SecurityManager.checkPermission
method is called with a
PropertyPermission(key, "write")
permission. This may result
in a SecurityException being thrown. If no exception is thrown, the
specified property is set to the given value.
value
- the value of the system property.null
if it did not have one.SecurityException
- if a security manager exists and its
checkPermission
method doesn't allow setting
of the specified property.NullPointerException
- if getName()
or value
is null
.IllegalArgumentException
- if getName()
is empty.void clear()
Copyright © 2003–2022 XDEV Software. All rights reserved.