Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

java.security
Class PermissionCollection  view PermissionCollection download PermissionCollection.java

java.lang.Object
  extended byjava.security.PermissionCollection
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
AllPermission.AllPermissionCollection, BasicPermission.BasicPermissionCollection, Permissions, Permissions.PermissionsHash, UnresolvedPermissionCollection

public abstract class PermissionCollection
extends java.lang.Object
implements java.io.Serializable

This class models a group of Java permissions. It has convenient methods for determining whether or not a given permission is implied by any of the permissions in this collection.

Some care must be taken in storing permissions. First, a collection of the appropriate type must be created. This is done by calling the newPermissionCollection method on an object of the permission class you wish to add to the collection. If this method returns null, any type of PermissionCollection can be used to store permissions of that type. However, if a PermissionCollection collection object is returned, that type must be used.

A PermissionCollection returned by the newPermissionCollection method in a subclass of Permission is a homogeneous collection. It only will hold permissions of one specified type - instances of the class that created it. Not all PermissionCollection subclasses have to hold permissions of only one type however. For example, the Permissions class holds permissions of many types.

Since the newPermissionCollection in Permission itself returns null, by default a permission can be stored in any type of collection unless it overrides that method to create its own collection type.

Since:
1.1

Field Summary
private  boolean readOnly
          Indicates whether or not this collection is read only.
private static long serialVersionUID
          Compatible with JDK 1.1+.
 
Constructor Summary
PermissionCollection()
          Create a new collection.
 
Method Summary
abstract  void add(Permission perm)
          This method adds a new Permission object to the collection.
abstract  java.util.Enumeration elements()
          This method returns an Enumeration of all the objects in this collection.
abstract  boolean implies(Permission perm)
          This method tests whether the specified Permission object is implied by this collection of Permission objects.
 boolean isReadOnly()
          This method tests whether or not this PermissionCollection object is read only.
 void setReadOnly()
          This method sets this PermissionCollection object to be read only.
 java.lang.String toString()
          This method returns a String representation of this collection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
Compatible with JDK 1.1+.

See Also:
Constant Field Values

readOnly

private boolean readOnly
Indicates whether or not this collection is read only.

Constructor Detail

PermissionCollection

public PermissionCollection()
Create a new collection.

Method Detail

add

public abstract void add(Permission perm)
This method adds a new Permission object to the collection.


implies

public abstract boolean implies(Permission perm)
This method tests whether the specified Permission object is implied by this collection of Permission objects.


elements

public abstract java.util.Enumeration elements()
This method returns an Enumeration of all the objects in this collection.


setReadOnly

public void setReadOnly()
This method sets this PermissionCollection object to be read only. No further permissions can be added to it after calling this method.


isReadOnly

public boolean isReadOnly()
This method tests whether or not this PermissionCollection object is read only.


toString

public java.lang.String toString()
This method returns a String representation of this collection. It is formed by:
 super.toString()" (\n"
   // enumerate all permissions, one per line
 ")\n"