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,AbstractSimpleNamePermission
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:
-
Field Summary
Fields inherited from interface org.wildfly.security.permission.PermissionVerifier
ALL, NONE -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedConstruct a new instance. -
Method Summary
Modifier and TypeMethodDescriptionbooleanDetermine whether this permission object is equal to another object of this permission type.inthashCode()Get the hash code of this permission.booleanDetermine whether this permission implies another permission.booleanimpliesName(String name) Determine whether this permission implies the given name.final 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.final booleannameEquals(Permission permission) Determine whether this permission has a name equal to the name of the given permission.final booleannameEquals(This permission) Determine whether this permission has a name equal to the name of the given permission.protected intGet the hash code of the name.abstract ThisCreate 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, requireEmptyActionsMethods inherited from class java.security.Permission
checkGuard, getName, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.wildfly.security.permission.PermissionVerifier
and, checkPermission, not, or, toPermissionCollection, unless, xor
-
Constructor Details
-
AbstractNamedPermission
Construct a new instance.- Parameters:
name- the permission name (must not benull)
-
-
Method Details
-
withName
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
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
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
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
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
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
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
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
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
-