public class GetBooleanAction
extends java.lang.Object
implements java.security.PrivilegedAction<java.lang.Boolean>
An instance of this class can be used as the argument of
AccessController.doPrivileged.
The following code retrieves the boolean value of the system
property named "prop" as a privileged action:
boolean b = java.security.AccessController.doPrivileged
(new GetBooleanAction("prop")).booleanValue();
PrivilegedAction,
AccessController| Constructor and Description |
|---|
GetBooleanAction(java.lang.String theProp)
Constructor that takes the name of the system property whose boolean
value needs to be determined.
|
| Modifier and Type | Method and Description |
|---|---|
static boolean |
privilegedGetProperty(java.lang.String theProp)
Convenience method to get a property without going through doPrivileged
if no security manager is present.
|
java.lang.Boolean |
run()
Determines the boolean value of the system property whose name was
specified in the constructor.
|
public GetBooleanAction(java.lang.String theProp)
theProp - the name of the system property.public java.lang.Boolean run()
run in interface java.security.PrivilegedAction<java.lang.Boolean>Boolean value of the system property.public static boolean privilegedGetProperty(java.lang.String theProp)
theProp - the name of the system property.