public class PropertyPermission extends Permission
PropertyLoader.getProperty(String)
or
PropertyLoader.getProperty(String, String)
or PropertyRegistry.setProperty(String, String)
or
PropertyRegistry.removeProperty(String)
.Modifier and Type | Field and Description |
---|---|
static String |
GET_ACTION
Action associated with
PropertyLoader.getProperty(String) or
PropertyLoader.getProperty(String, String) . |
static String |
REMOVE_ACTION
Action associated with
PropertyRegistry.removeProperty(String) . |
static String |
SET_ACTION
Action associated with
PropertyRegistry.setProperty(String, String) . |
Constructor and Description |
---|
PropertyPermission(String parentName,
String key,
String action)
Creates a permission for the given property.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj)
Checks two Permission objects for equality.
|
String |
getActions()
Returns the actions as a String.
|
String |
getKey()
Gets the property key handled by this permission.
|
int |
hashCode()
Returns the hash code value for this Permission object.
|
boolean |
implies(Permission permission)
Checks if the specified permission's actions are "implied by" this object's actions.
|
getName, toString
public static final String GET_ACTION
PropertyLoader.getProperty(String)
or
PropertyLoader.getProperty(String, String)
.public static final String REMOVE_ACTION
PropertyRegistry.removeProperty(String)
.public static final String SET_ACTION
PropertyRegistry.setProperty(String, String)
.public PropertyPermission(String parentName, String key, String action)
The action can be one of
, GET_ACTION
or
SET_ACTION
.REMOVE_ACTION
parentName
- the name of the service loader or service registry.key
- the property key.action
- the action realized with the service.public boolean equals(@Nullable Object obj)
Permission
Do not use the equals
method for making access control decisions; use the
implies
method.
equals
in class Permission
obj
- the object we are testing for equality with this object.Object.hashCode()
,
HashMap
public String getActions()
Permission
perm1 = new FilePermission(p1, "read,write"); perm2 = new FilePermission(p2, "write,read");both return "read,write" when the
getActions
method is invoked.getActions
in class Permission
public String getKey()
public int hashCode()
Permission
The required hashCode
behavior for Permission Objects is the following:
hashCode
method must consistently return the same integer.
This integer need not remain consistent from one execution of an application to another execution
of the same application.
equals
method, then calling
the hashCode
method on each of the two Permission objects must produce the same
integer result.
hashCode
in class Permission
Object.equals(java.lang.Object)
,
System.identityHashCode(java.lang.Object)
public boolean implies(@Nullable Permission permission)
Permission
This must be implemented by subclasses of Permission, as they are the only ones that can impose semantics on a Permission object.
implies
in class Permission
permission
- the permission to check against.