|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.ibm.security12.sun.security.action.GetIntegerAction
A convenience class for retrieving the integer 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 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 = (Integer)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();
java.security.PrivilegedAction
,
java.security.AccessController
Constructor Summary | |
GetIntegerAction(String theProp)
Constructor that takes the name of the system property whose integer value needs to be determined. |
|
GetIntegerAction(String theProp,
int defaultVal)
Constructor that takes the name of the system property and the default value of that property. |
Method Summary | |
Object |
run()
Determines the integer value of the system property whose name was specified in the constructor. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public GetIntegerAction(String theProp)
theProp
- the name of the system property.public GetIntegerAction(String theProp, int defaultVal)
theProp
- the name of the system property.defaulVal
- the default value.Method Detail |
public Object run()
If there is no property of the specified name, or if the property
does not have the correct numeric format, then an Integer
object representing the default value that was specified in the
constructor is returned, or null
if no default value was
specified.
Integer
value of the property.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |