Top Description Fields Constructors Methods
sun.security.action

public Class GetBooleanAction

extends Object
implements PrivilegedAction<Boolean>
Class Inheritance
All Implemented Interfaces
java.security.PrivilegedAction
Imports
java.security.AccessController

A convenience class for retrieving the boolean value of a system property as a privileged action.

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();
Author
Roland Schemers
Since
1.2
See Also
java.security.PrivilegedAction, java.security.AccessController

Field Summary

Modifier and TypeField and Description
private final String

Constructor Summary

AccessConstructor and Description
public
GetBooleanAction(String
the name of the system property.
theProp
)

Constructor that takes the name of the system property whose boolean value needs to be determined.

Method Summary

Modifier and TypeMethod and Description
public static boolean
privilegedGetProperty(String
the name of the system property.
theProp
)

Convenience method to get a property without going through doPrivileged if no security manager is present.

public Boolean

Returns:

the Boolean value of the system property.
run
()

Implements java.security.PrivilegedAction.run.

Determines the boolean value of the system property whose name was specified in the constructor.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

thePropback to summary
private final String theProp

Constructor Detail

GetBooleanActionback to summary
public GetBooleanAction(String theProp)

Constructor that takes the name of the system property whose boolean value needs to be determined.

Parameters
theProp:String

the name of the system property.

Method Detail

privilegedGetPropertyback to summary
public static boolean privilegedGetProperty(String theProp)

Convenience method to get a property without going through doPrivileged if no security manager is present. This is unsafe for inclusion in a public API but allowable here since this class is now encapsulated. Note that this method performs a privileged action using caller-provided inputs. The caller of this method should take care to ensure that the inputs are not tainted and the returned property is not made accessible to untrusted code if it contains sensitive information.

Parameters
theProp:String

the name of the system property.

Annotations
@SuppressWarnings:removal
runback to summary
public Boolean run()

Implements java.security.PrivilegedAction.run.

Determines the boolean value of the system property whose name was specified in the constructor.

Returns:Boolean

the Boolean value of the system property.