KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > commons > collections > buffer > AbstractBufferDecorator


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 org.apache.commons.collections.buffer;
17
18 import org.apache.commons.collections.Buffer;
19 import org.apache.commons.collections.collection.AbstractCollectionDecorator;
20
21 /**
22  * Decorates another <code>Buffer</code> to provide additional behaviour.
23  * <p>
24  * Methods are forwarded directly to the decorated buffer.
25  *
26  * @since Commons Collections 3.0
27  * @version $Revision: 1.4 $ $Date: 2004/06/02 21:53:02 $
28  *
29  * @author Stephen Colebourne
30  */

31 public abstract class AbstractBufferDecorator extends AbstractCollectionDecorator implements Buffer {
32
33     /**
34      * Constructor only used in deserialization, do not use otherwise.
35      * @since Commons Collections 3.1
36      */

37     protected AbstractBufferDecorator() {
38         super();
39     }
40
41     /**
42      * Constructor that wraps (not copies).
43      *
44      * @param buffer the buffer to decorate, must not be null
45      * @throws IllegalArgumentException if list is null
46      */

47     protected AbstractBufferDecorator(Buffer buffer) {
48         super(buffer);
49     }
50
51     /**
52      * Gets the buffer being decorated.
53      *
54      * @return the decorated buffer
55      */

56     protected Buffer getBuffer() {
57         return (Buffer) getCollection();
58     }
59
60     //-----------------------------------------------------------------------
61
public Object JavaDoc get() {
62         return getBuffer().get();
63     }
64
65     public Object JavaDoc remove() {
66         return getBuffer().remove();
67     }
68
69 }
70
Popular Tags