View Javadoc

1   /*
2    *  Copyright 2003-2004 The Apache Software Foundation
3    *
4    *  Licensed under the Apache License, Version 2.0 (the "License");
5    *  you may not use this file except in compliance with the License.
6    *  You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
10   *  Unless required by applicable law or agreed to in writing, software
11   *  distributed under the License is distributed on an "AS IS" BASIS,
12   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   *  See the License for the specific language governing permissions and
14   *  limitations under the License.
15   */
16  package net.sf.collections15.set;
17  
18  import java.util.Set;
19  
20  import net.sf.collections15.collection.AbstractCollectionDecorator;
21  
22  
23  /***
24   * Decorates another <code>Set</code> to provide additional behaviour.
25   * <p>
26   * Methods are forwarded directly to the decorated set.
27   *
28   * @since Commons Collections 3.0
29   * @version $Revision: 1.1 $ $Date: 2005/05/03 22:45:38 $
30   * 
31   * @author Stephen Colebourne
32   */
33  public abstract class AbstractSetDecorator<E>
34  			extends AbstractCollectionDecorator<E>
35  			implements Set<E>
36  {
37  
38      /***
39       * Constructor only used in deserialization, do not use otherwise.
40       * @since Commons Collections 3.1
41       */
42      protected AbstractSetDecorator() {
43          super();
44      }
45  
46      /***
47       * Constructor that wraps (not copies).
48       * 
49       * @param set  the set to decorate, must not be null
50       * @throws IllegalArgumentException if set is null
51       */
52      protected AbstractSetDecorator(Set<E> set) {
53          super(set);
54      }
55  
56      /***
57       * Gets the set being decorated.
58       * 
59       * @return the decorated set
60       */
61      protected Set<E> getSet() {
62          return (Set<E>) getCollection();
63      }
64  
65  }