java.util
Class PropertyPermission

java.lang.Object
  extended by java.security.Permission
      extended by java.security.BasicPermission
          extended by java.util.PropertyPermission
All Implemented Interfaces:
Serializable, Guard

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, Serialized Form

Constructor Summary
PropertyPermission(String name, String actions)
          Constructs a PropertyPermission with the specified property.
 
Method Summary
 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.
 String getActions()
          Returns the action string.
 int hashCode()
          Returns the hash code for this permission.
 boolean implies(Permission p)
          Check if this permission implies p.
 PermissionCollection newPermissionCollection()
          Returns a permission collection suitable to take PropertyPermission objects.
 
Methods inherited from class java.security.Permission
checkGuard, getName, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

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

implies

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

Overrides:
implies in class BasicPermission
Parameters:
p - the permission to check
Returns:
true if this permission implies p

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.

Overrides:
equals in class BasicPermission
Parameters:
obj - the other object
Returns:
true if the two are equivalent
See Also:
Object.hashCode()

hashCode

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

Overrides:
hashCode in class BasicPermission
Returns:
the hash code
See Also:
Object.equals(Object), System.identityHashCode(Object)

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.

Overrides:
getActions in class BasicPermission
Returns:
one of "read", "write", or "read,write"

newPermissionCollection

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

Overrides:
newPermissionCollection in class BasicPermission
Returns:
a new empty PermissionCollection