java.util

Class PropertyPermission

public final class PropertyPermission extends BasicPermission

This class represents the permission to access and modify a property.
The name is the name of the property, e.g. xxx. You can also use an asterisk "*" as described in BasicPermission.
The action string is a comma-separated list of keywords. There are two possible actions:
read
Allows to read the property via System.getProperty.
write
Allows to write the property via System.setProperty.
The action string is case insensitive (it is converted to lower case).

Since: 1.2

See Also: Permission BasicPermission SecurityManager

UNKNOWN: updated to 1.4

Constructor Summary
PropertyPermission(String name, String actions)
Constructs a PropertyPermission with the specified property.
Method Summary
booleanequals(Object obj)
Check to see whether this object is the same as another PropertyPermission object; this is true if it has the same name and actions.
StringgetActions()
Returns the action string.
inthashCode()
Returns the hash code for this permission.
booleanimplies(Permission p)
Check if this permission implies p.
PermissionCollectionnewPermissionCollection()
Returns a permission collection suitable to take PropertyPermission objects.

Constructor Detail

PropertyPermission

public PropertyPermission(String name, String actions)
Constructs a PropertyPermission with the specified property. Possible actions are read and write, comma-separated and case-insensitive.

Parameters: name the name of the property actions the action string

Throws: NullPointerException if name is null IllegalArgumentException if name string contains an illegal wildcard or actions string contains an illegal action (this includes a null actions string)

Method Detail

equals

public boolean equals(Object obj)
Check to see whether this object is the same as another PropertyPermission object; this is true if it has the same name and actions.

Parameters: obj the other object

Returns: true if the two are equivalent

getActions

public String getActions()
Returns the action string. Note that this may differ from the string given at the constructor: The actions are converted to lowercase and may be reordered.

Returns: one of "read", "write", or "read,write"

hashCode

public int hashCode()
Returns the hash code for this permission. It is equivalent to getName().hashCode().

Returns: the hash code

implies

public boolean implies(Permission p)
Check if this permission implies p. This returns true iff all of the following conditions are true:

Parameters: p the permission to check

Returns: true if this permission implies p

newPermissionCollection

public PermissionCollection newPermissionCollection()
Returns a permission collection suitable to take PropertyPermission objects.

Returns: a new empty PermissionCollection