/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package java.security; import java.io.Serializable; import java.util.ArrayList; import java.util.Enumeration; import java.util.List; /** * {@code PermissionCollection} is the common base class for all collections * that provide a convenient method for determining whether or not a given * permission is implied by any of the permissions present in this collection. *
* A {@code PermissionCollection} is typically created by using the * {@link Permission#newPermissionCollection()} factory method. If the mentioned * method returns {@code null}, then a {@code PermissionCollection} of any type * can be used. If a collection is returned, it must be used for holding several * permissions of the particular type. *
* Subclasses must be implemented thread save.
*/
public abstract class PermissionCollection implements Serializable {
private static final long serialVersionUID = -6727011328946861783L;
private boolean readOnly; // = false;
/**
* Adds the specified {@code Permission} to this collection.
*
* @param permission
* the {@code Permission} to add.
* @throws IllegalStateException
* if the collection is read only.
*/
public abstract void add(Permission permission);
/**
* Returns an enumeration over all {@link Permission}s encapsulated by this
* {@code PermissionCollection}.
*
* @return an enumeration over all {@link Permission}s.
*/
public abstract Enumeration