Top Description Fields Constructors Methods
java.security

pack-priv final Class BasicPermissionCollection

Located in compilation unit of java.security.BasicPermission.

extends PermissionCollection
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable

A BasicPermissionCollection stores a collection of BasicPermission permissions. BasicPermission objects must be stored in a manner that allows them to be inserted in any order, but enable the implies function to evaluate the implies method in an efficient (and consistent) manner. A BasicPermissionCollection handles comparing a permission like "a.b.c.d.e" with a Permission such as "a.b.*", or "*".
Author
Roland Schemers
See Also
java.security.Permission, java.security.Permissions

Field Summary

Modifier and TypeField and Description
private boolean
all_allowed

This is set to true if this BasicPermissionCollection contains a BasicPermission with '*' as its permission name.

private Class<?>
permClass

The class to which all BasicPermission objects in this BasicPermissionCollection belong.

private transient ConcurrentHashMap<String, Permission>
perms

Key is name, value is permission.

private static final ObjectStreamField[]
private static final long

Constructor Summary

AccessConstructor and Description
public
BasicPermissionCollection(Class<?> clazz)

Create an empty BasicPermissionCollection object.

Method Summary

Modifier and TypeMethod and Description
public void
add(Permission
the Permission object to add.
permission
)

Implements abstract java.security.PermissionCollection.add.

Adds a permission to the BasicPermission object.

public Enumeration<Permission>

Returns:

an enumeration of all the BasicPermission objects.
elements
()

Implements abstract java.security.PermissionCollection.elements.

Returns an enumeration of all the BasicPermission objects in the container.

public boolean

Returns:

true if "permission" is a proper subset of a permission in the set, false if not.
implies
(Permission
the Permission object to compare
permission
)

Implements abstract java.security.PermissionCollection.implies.

Check and see if this set of permissions implies the permissions expressed in "permission".

private void
readObject(ObjectInputStream
the ObjectInputStream from which data is read
in
)

readObject is called to restore the state of the BasicPermissionCollection from a stream.

private void
writeObject(ObjectOutputStream
the ObjectOutputStream to which data is written
out
)

Writes the contents of the perms field out as a Hashtable for serialization compatibility with earlier releases.

Inherited from java.security.PermissionCollection:
elementsAsStreamisReadOnlysetReadOnlytoString

Field Detail

all_allowedback to summary
private boolean all_allowed

This is set to true if this BasicPermissionCollection contains a BasicPermission with '*' as its permission name.

See Also
serialPersistentFields
permClassback to summary
private Class<?> permClass

The class to which all BasicPermission objects in this BasicPermissionCollection belong.

See Also
serialPersistentFields
permsback to summary
private transient ConcurrentHashMap<String, Permission> perms

Key is name, value is permission. All permission objects in collection must be of the same type. Not serialized; see serialization section at end of class.

serialPersistentFieldsback to summary
private static final ObjectStreamField[] serialPersistentFields
Annotations
@Serial
Serial Fields:
permissions:Hashtable
The BasicPermission objects in this BasicPermissionCollection. All BasicPermission objects in the collection must belong to the same class. The Hashtable is indexed by the BasicPermission name; the value of the Hashtable entry is the permission.
all_allowed:boolean
This is set to true if this BasicPermissionCollection contains a BasicPermission object with '*' as its permission name.
permClass:Class
The class to which all BasicPermission objectss in this BasicPermissionCollection belongs.
serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.security.PermissionCollection.serialVersionUID.

Annotations
@Serial

Constructor Detail

BasicPermissionCollectionback to summary
public BasicPermissionCollection(Class<?> clazz)

Create an empty BasicPermissionCollection object.

Method Detail

addback to summary
public void add(Permission permission)

Implements abstract java.security.PermissionCollection.add.

Adds a permission to the BasicPermission object. The key for the hash is permission.path.

Parameters
permission:Permission

the Permission object to add.

Annotations
@Override
Exceptions
IllegalArgumentException:
if the permission is not a BasicPermission, or if the permission is not of the same class as the other permissions in this collection.
SecurityException:
if this BasicPermissionCollection object has been marked readonly
elementsback to summary
public Enumeration<Permission> elements()

Implements abstract java.security.PermissionCollection.elements.

Returns an enumeration of all the BasicPermission objects in the container.

Returns:Enumeration<Permission>

an enumeration of all the BasicPermission objects.

Annotations
@Override
impliesback to summary
public boolean implies(Permission permission)

Implements abstract java.security.PermissionCollection.implies.

Check and see if this set of permissions implies the permissions expressed in "permission".

Parameters
permission:Permission

the Permission object to compare

Returns:boolean

true if "permission" is a proper subset of a permission in the set, false if not.

Annotations
@Override
readObjectback to summary
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException

readObject is called to restore the state of the BasicPermissionCollection from a stream.

Parameters
in:ObjectInputStream

the ObjectInputStream from which data is read

Annotations
@Serial
Exceptions
IOException:
if an I/O error occurs
ClassNotFoundException:
if a serialized class cannot be loaded
writeObjectback to summary
private void writeObject(ObjectOutputStream out) throws IOException

Writes the contents of the perms field out as a Hashtable for serialization compatibility with earlier releases. all_allowed and permClass unchanged.

Parameters
out:ObjectOutputStream

the ObjectOutputStream to which data is written

Annotations
@Serial
Exceptions
IOException:
if an I/O error occurs