Class AbstractPermission
- java.lang.Object
-
- org.springframework.security.acls.domain.AbstractPermission
-
- All Implemented Interfaces:
java.io.Serializable,Permission
- Direct Known Subclasses:
BasePermission,CumulativePermission
public abstract class AbstractPermission extends java.lang.Object implements Permission
Provides an abstract superclass forPermissionimplementations.- Since:
- 2.0.3
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected charcodeprotected intmask-
Fields inherited from interface org.springframework.security.acls.model.Permission
RESERVED_OFF, RESERVED_ON, THIRTY_TWO_RESERVED_OFF
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractPermission(int mask)Sets the permission mask and uses the '*' character to represent active bits when represented as a bit pattern string.protectedAbstractPermission(int mask, char code)Sets the permission mask and uses the specified character for active bits.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)intgetMask()Returns the bits that represents the permission.java.lang.StringgetPattern()Returns a 32-character long bit patternStringrepresenting this permission.inthashCode()java.lang.StringtoString()
-
-
-
Constructor Detail
-
AbstractPermission
protected AbstractPermission(int mask)
Sets the permission mask and uses the '*' character to represent active bits when represented as a bit pattern string.- Parameters:
mask- the integer bit mask for the permission
-
AbstractPermission
protected AbstractPermission(int mask, char code)Sets the permission mask and uses the specified character for active bits.- Parameters:
mask- the integer bit mask for the permissioncode- the character to print for each active bit in the mask (seePermission.getPattern())
-
-
Method Detail
-
equals
public final boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public final int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public final java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getMask
public final int getMask()
Description copied from interface:PermissionReturns the bits that represents the permission.- Specified by:
getMaskin interfacePermission- Returns:
- the bits that represent the permission
-
getPattern
public java.lang.String getPattern()
Description copied from interface:PermissionReturns a 32-character long bit patternStringrepresenting this permission.Implementations are free to format the pattern as they see fit, although under no circumstances may
Permission.RESERVED_OFForPermission.RESERVED_ONbe used within the pattern. An exemption is in the case ofPermission.RESERVED_OFFwhich is used to denote a bit that is off (clear). Implementations may also elect to usePermission.RESERVED_ONinternally for computation purposes, although this method may not return anyStringcontainingPermission.RESERVED_ON.The returned String must be 32 characters in length.
This method is only used for user interface and logging purposes. It is not used in any permission calculations. Therefore, duplication of characters within the output is permitted.
- Specified by:
getPatternin interfacePermission- Returns:
- a 32-character bit pattern
-
-