Package org.wildfly.security.permission
Class AbstractPermission<This extends AbstractPermission<This>>
- java.lang.Object
-
- java.security.Permission
-
- org.wildfly.security.permission.AbstractPermission<This>
-
- All Implemented Interfaces:
Serializable
,Guard
,PermissionVerifier
- Direct Known Subclasses:
AbstractBooleanPermission
,AbstractNamedPermission
,NoPermission
public abstract class AbstractPermission<This extends AbstractPermission<This>> extends Permission implements PermissionVerifier
An abstract base class for any permission.- Author:
- David M. Lloyd
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from interface org.wildfly.security.permission.PermissionVerifier
ALL, NONE
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractPermission(String name)
Construct a new instance.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
Determine whether this permission object is equal to another object.abstract boolean
equals(This other)
Determine whether this permission object is equal to another object of this permission type.String
getActions()
Get the actions string.abstract int
hashCode()
Get the hash code of this permission.boolean
implies(Permission permission)
Determine whether this permission implies another permission.abstract boolean
implies(This permission)
Determine whether this permission implies another permission.AbstractPermissionCollection
newPermissionCollection()
Get an empty permission collection which is capable of holding instances of this permission type.protected static void
requireEmptyActions(String actions)
Check to ensure that the given action string is empty ornull
; otherwise, throw an exception.-
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
-
Methods inherited from interface org.wildfly.security.permission.PermissionVerifier
and, checkPermission, not, or, toPermissionCollection, unless, xor
-
-
-
-
Constructor Detail
-
AbstractPermission
protected AbstractPermission(String name)
Construct a new instance.- Parameters:
name
- the permission name
-
-
Method Detail
-
implies
public final boolean implies(Permission permission)
Determine whether this permission implies another permission.- Specified by:
implies
in interfacePermissionVerifier
- Specified by:
implies
in classPermission
- Parameters:
permission
- the other permission- Returns:
true
if this permission implies the other;false
otherwise
-
implies
public abstract boolean implies(This permission)
Determine whether this permission implies another permission.- Parameters:
permission
- the other permission- Returns:
true
if this permission implies the other;false
otherwise
-
equals
public final boolean equals(Object obj)
Determine whether this permission object is equal to another object.- Specified by:
equals
in classPermission
- Parameters:
obj
- the object to compare to- Returns:
true
if the object is a permission equal to this one;false
otherwise
-
equals
public abstract boolean equals(This other)
Determine whether this permission object is equal to another object of this permission type.- Parameters:
other
- the permission to compare to- Returns:
true
if the object is a permission equal to this one;false
otherwise
-
hashCode
public abstract int hashCode()
Get the hash code of this permission. The result must be consistent with the definedequals(AbstractPermission)
result.- Specified by:
hashCode
in classPermission
- Returns:
- the hash code of this permission
-
getActions
public String getActions()
Get the actions string. The default implementation always returns an empty string.- Specified by:
getActions
in classPermission
- Returns:
- the actions string (not
null
)
-
newPermissionCollection
public AbstractPermissionCollection newPermissionCollection()
Get an empty permission collection which is capable of holding instances of this permission type.The default implementation returns a
SimplePermissionCollection
.- Overrides:
newPermissionCollection
in classPermission
- Returns:
- the permission collection to use
-
requireEmptyActions
protected static void requireEmptyActions(String actions) throws IllegalArgumentException
Check to ensure that the given action string is empty ornull
; otherwise, throw an exception.- Parameters:
actions
- the actions string- Throws:
IllegalArgumentException
- if the actions string is not empty
-
-