Package org.wildfly.security.permission
Class AbstractNamedPermission<This extends AbstractNamedPermission<This>>
- java.lang.Object
-
- java.security.Permission
-
- org.wildfly.security.permission.AbstractPermission<This>
-
- org.wildfly.security.permission.AbstractNamedPermission<This>
-
- All Implemented Interfaces:
Serializable,Guard,PermissionVerifier
- Direct Known Subclasses:
AbstractActionPermission,AbstractNameOnlyPermission
public abstract class AbstractNamedPermission<This extends AbstractNamedPermission<This>> extends AbstractPermission<This>
An abstract base class for named permissions with useful API and implementation methods.Subclasses of this class are always serialized as a special serialized permission object, which captures the type class, the permission name (if any), and the permission action (if any) as a string. Therefore, none of the fields of any subclass of this class are serialized unless they are included in the name or actions properties.
Concrete subclasses are expected to be immutable and final.
- 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 protectedAbstractNamedPermission(String name)Construct a new instance.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description booleanequals(This other)Determine whether this permission object is equal to another object of this permission type.inthashCode()Get the hash code of this permission.booleanimplies(This permission)Determine whether this permission implies another permission.booleanimpliesName(String name)Determine whether this permission implies the given name.booleanimpliesName(Permission permission)Determine whether this permission implies the name of the given permission.booleanimpliesName(This permission)Determine whether this permission implies the name of the given permission.booleannameEquals(String name)Determine whether this permission has a name equal to the given name.booleannameEquals(Permission permission)Determine whether this permission has a name equal to the name of the given permission.booleannameEquals(This permission)Determine whether this permission has a name equal to the name of the given permission.protected intnameHashCode()Get the hash code of the name.abstract ThiswithName(String name)Create a new permission which is identical to this one, except with a newname.-
Methods inherited from class org.wildfly.security.permission.AbstractPermission
equals, getActions, implies, newPermissionCollection, requireEmptyActions
-
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
-
AbstractNamedPermission
protected AbstractNamedPermission(String name)
Construct a new instance.- Parameters:
name- the permission name (must not benull)
-
-
Method Detail
-
withName
public abstract This withName(String name)
Create a new permission which is identical to this one, except with a newname.- Parameters:
name- the name to use (must not benull)- Returns:
- the new permission
-
nameEquals
public boolean nameEquals(String name)
Determine whether this permission has a name equal to the given name.- Parameters:
name- the name to check- Returns:
trueif this permission's name is equal to the given name,falseotherwise
-
nameEquals
public final boolean nameEquals(Permission permission)
Determine whether this permission has a name equal to the name of the given permission. If the given permission is of a different type than this permission,falseis returned.- Parameters:
permission- the permission whose name is to be checked- Returns:
trueif this permission's name is equal to the given permission's name,falseotherwise
-
nameEquals
public final boolean nameEquals(This permission)
Determine whether this permission has a name equal to the name of the given permission.- Parameters:
permission- the permission whose name is to be checked- Returns:
trueif this permission's name is equal to the given permission's name,falseotherwise
-
nameHashCode
protected int nameHashCode()
Get the hash code of the name. The default implementation returnsgetName().hashCode().- Returns:
- the hash code of the name
-
impliesName
public boolean impliesName(String name)
Determine whether this permission implies the given name.- Parameters:
name- the name to check- Returns:
trueif this permission's name implies the given name,falseotherwise
-
impliesName
public final boolean impliesName(Permission permission)
Determine whether this permission implies the name of the given permission. If the permission is not of the same type as this permission,falseis returned.- Parameters:
permission- the permission whose name is to be checked- Returns:
trueif this permission's name implies the given name,falseotherwise
-
impliesName
public boolean impliesName(This permission)
Determine whether this permission implies the name of the given permission.- Parameters:
permission- the permission whose name is to be checked- Returns:
trueif this permission's name implies the given name,falseotherwise
-
implies
public boolean implies(This permission)
Description copied from class:AbstractPermissionDetermine whether this permission implies another permission.- Specified by:
impliesin classAbstractPermission<This extends AbstractNamedPermission<This>>- Parameters:
permission- the other permission- Returns:
trueif this permission implies the other;falseotherwise
-
equals
public boolean equals(This other)
Description copied from class:AbstractPermissionDetermine whether this permission object is equal to another object of this permission type.- Specified by:
equalsin classAbstractPermission<This extends AbstractNamedPermission<This>>- Parameters:
other- the permission to compare to- Returns:
trueif the object is a permission equal to this one;falseotherwise
-
hashCode
public int hashCode()
Description copied from class:AbstractPermissionGet the hash code of this permission. The result must be consistent with the definedAbstractPermission.equals(AbstractPermission)result.- Specified by:
hashCodein classAbstractPermission<This extends AbstractNamedPermission<This>>- Returns:
- the hash code of this permission
-
-