01: /*
02: * Copyright 2003-2004 The Apache Software Foundation
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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: 155406 $ $Date: 2005-02-26 12:55:26 +0000 (Sat, 26 Feb 2005) $
28: *
29: * @author Stephen Colebourne
30: */
31: public abstract class AbstractBufferDecorator extends
32: AbstractCollectionDecorator implements Buffer {
33:
34: /**
35: * Constructor only used in deserialization, do not use otherwise.
36: * @since Commons Collections 3.1
37: */
38: protected AbstractBufferDecorator() {
39: super ();
40: }
41:
42: /**
43: * Constructor that wraps (not copies).
44: *
45: * @param buffer the buffer to decorate, must not be null
46: * @throws IllegalArgumentException if list is null
47: */
48: protected AbstractBufferDecorator(Buffer buffer) {
49: super (buffer);
50: }
51:
52: /**
53: * Gets the buffer being decorated.
54: *
55: * @return the decorated buffer
56: */
57: protected Buffer getBuffer() {
58: return (Buffer) getCollection();
59: }
60:
61: //-----------------------------------------------------------------------
62: public Object get() {
63: return getBuffer().get();
64: }
65:
66: public Object remove() {
67: return getBuffer().remove();
68: }
69:
70: }
|