Class PermissionInfo
This class encapsulates three pieces of information: a Permission type
(class name), which must be a subclass of
java.security.Permission, and the name and actions
arguments passed to its constructor.
In order for a permission represented by a PermissionInfo to be
instantiated and considered during a permission check, its Permission class
must be available from the system classpath or an exported package. This
means that the instantiation of a permission represented by a
PermissionInfo may be delayed until the package containing its
Permission class has been exported by a bundle.
-
Constructor Summary
ConstructorsConstructorDescriptionPermissionInfo(String encodedPermission) Constructs aPermissionInfoobject from the specified encodedPermissionInfostring.PermissionInfo(String type, String name, String actions) Constructs aPermissionInfofrom the specified type, name, and actions. -
Method Summary
Modifier and TypeMethodDescriptionbooleanDetermines the equality of twoPermissionInfoobjects.final StringReturns the actions of the permission represented by thisPermissionInfo.final StringReturns the string encoding of thisPermissionInfoin a form suitable for restoring thisPermissionInfo.final StringgetName()Returns the name of the permission represented by thisPermissionInfo.final StringgetType()Returns the fully qualified class name of the permission represented by thisPermissionInfo.inthashCode()Returns the hash code value for this object.toString()Returns the string representation of thisPermissionInfo.
-
Constructor Details
-
PermissionInfo
Constructs aPermissionInfofrom the specified type, name, and actions.- Parameters:
type- The fully qualified class name of the permission represented by thisPermissionInfo. The class must be a subclass ofjava.security.Permissionand must define a 2-argument constructor that takes a name string and an actions string.name- The permission name that will be passed as the first argument to the constructor of thePermissionclass identified bytype.actions- The permission actions that will be passed as the second argument to the constructor of thePermissionclass identified bytype.- Throws:
NullPointerException- Iftypeisnull.IllegalArgumentException- Ifactionis notnullandnameisnull.
-
PermissionInfo
Constructs aPermissionInfoobject from the specified encodedPermissionInfostring. White space in the encodedPermissionInfostring is ignored.- Parameters:
encodedPermission- The encodedPermissionInfo.- Throws:
IllegalArgumentException- If the specifiedencodedPermissionis not properly formatted.- See Also:
-
-
Method Details
-
getEncoded
Returns the string encoding of thisPermissionInfoin a form suitable for restoring thisPermissionInfo.The encoded format is:
(type)
or(type "name")
or(type "name" "actions")
where name and actions are strings that must be encoded for proper parsing. Specifically, the",\, carriage return, and line feed characters must be escaped using\",\\,\r, and\n, respectively.The encoded string contains no leading or trailing whitespace characters. A single space character is used between type and "name" and between "name" and "actions".
- Returns:
- The string encoding of this
PermissionInfo.
-
toString
Returns the string representation of thisPermissionInfo. The string is created by calling thegetEncodedmethod on thisPermissionInfo. -
getType
Returns the fully qualified class name of the permission represented by thisPermissionInfo.- Returns:
- The fully qualified class name of the permission represented by
this
PermissionInfo.
-
getName
Returns the name of the permission represented by thisPermissionInfo.- Returns:
- The name of the permission represented by this
PermissionInfo, ornullif the permission does not have a name.
-
getActions
Returns the actions of the permission represented by thisPermissionInfo.- Returns:
- The actions of the permission represented by this
PermissionInfo, ornullif the permission does not have any actions associated with it.
-
equals
Determines the equality of twoPermissionInfoobjects. This method checks that specified object has the same type, name and actions as thisPermissionInfoobject. -
hashCode
public int hashCode()Returns the hash code value for this object.
-