int
value of a system property as a privileged action. An instance of this class can be used as the argument of {@link AccessController#doPrivileged(PrivilegedAction) AccessController.doPrivileged} or {@link Security#doPrivileged(PrivilegedAction) Security.doPrivileged}.
The following code retrieves the int
value of the system property named "prop"
as a privileged action. Since it does not pass a default value to be used in case the property "prop"
is not defined, it has to check the result for null
:
Integer tmp = (Integer) Security.doPrivileged(new GetIntegerAction("prop")); int i; if (tmp != null) { i = tmp.intValue(); }
The following code retrieves the int
value of the system property named "prop"
as a privileged action, and also passes a default value to be used in case the property "prop"
is not defined:
int i = ((Integer) Security.doPrivileged( new GetIntegerAction("prop", 3))).intValue();
If the protection domain of the immediate caller of doPrivileged
or the protection domain of this class does not imply the permissions necessary for the operation, the behavior is as if the system property is not defined.
@author Sun Microsystems, Inc.
@see PrivilegedAction
@see AccessController
@see Security
@since 2.0
An instance of this class can be used as the argument of AccessController.doPrivileged
.
The following code retrieves the integer value of the system property named "prop"
as a privileged action. Since it does not pass a default value to be used in case the property "prop"
is not defined, it has to check the result for null
:
Integer tmp = java.security.AccessController.doPrivileged (new sun.security.action.GetIntegerAction("prop")); int i; if (tmp != null) { i = tmp.intValue(); }
The following code retrieves the integer value of the system property named "prop"
as a privileged action, and also passes a default value to be used in case the property "prop"
is not defined:
int i = ((Integer)java.security.AccessController.doPrivileged( new GetIntegerAction("prop", 3))).intValue();@author Roland Schemers @see java.security.PrivilegedAction @see java.security.AccessController @since 1.2
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|