You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ba...@apache.org on 2009/09/15 07:54:25 UTC

svn commit: r815027 - /commons/proper/collections/trunk/src/java/org/apache/commons/collections/buffer/AbstractBufferDecorator.java

Author: bayard
Date: Tue Sep 15 05:54:25 2009
New Revision: 815027

URL: http://svn.apache.org/viewvc?rev=815027&view=rev
Log:
Merging from -r468106:814127 of collections_jdk5_branch - namely where this code was generified; mostly in r738956.

Also see the following revisions:

    ------------------------------------------------------------------------
    r471579 | scolebourne | 2006-11-05 16:14:58 -0800 (Sun, 05 Nov 2006) | 1 line
    
    Generify, remove getBuffer() - use covariant decorated()
    ------------------------------------------------------------------------
    r471173 | scolebourne | 2006-11-04 04:07:39 -0800 (Sat, 04 Nov 2006) | 1 line
    
    Abstract*Decorator - Generify and use covariant return types
    ------------------------------------------------------------------------

Modified:
    commons/proper/collections/trunk/src/java/org/apache/commons/collections/buffer/AbstractBufferDecorator.java

Modified: commons/proper/collections/trunk/src/java/org/apache/commons/collections/buffer/AbstractBufferDecorator.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/java/org/apache/commons/collections/buffer/AbstractBufferDecorator.java?rev=815027&r1=815026&r2=815027&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/java/org/apache/commons/collections/buffer/AbstractBufferDecorator.java (original)
+++ commons/proper/collections/trunk/src/java/org/apache/commons/collections/buffer/AbstractBufferDecorator.java Tue Sep 15 05:54:25 2009
@@ -24,12 +24,17 @@
  * <p>
  * Methods are forwarded directly to the decorated buffer.
  *
+ * @param <E> the type of the elements in the buffer
  * @since Commons Collections 3.0
  * @version $Revision$ $Date$
  *
  * @author Stephen Colebourne
  */
-public abstract class AbstractBufferDecorator extends AbstractCollectionDecorator implements Buffer {
+public abstract class AbstractBufferDecorator<E> extends AbstractCollectionDecorator<E> implements
+        Buffer<E> {
+
+    /** Serialization version */
+    private static final long serialVersionUID = -2629815475789577029L;
 
     /**
      * Constructor only used in deserialization, do not use otherwise.
@@ -45,7 +50,7 @@
      * @param buffer  the buffer to decorate, must not be null
      * @throws IllegalArgumentException if list is null
      */
-    protected AbstractBufferDecorator(Buffer buffer) {
+    protected AbstractBufferDecorator(Buffer<E> buffer) {
         super(buffer);
     }
 
@@ -54,17 +59,17 @@
      * 
      * @return the decorated buffer
      */
-    protected Buffer getBuffer() {
-        return (Buffer) getCollection();
+    protected Buffer<E> decorated() {
+        return (Buffer<E>) super.decorated();
     }
 
     //-----------------------------------------------------------------------
-    public Object get() {
-        return getBuffer().get();
+    public E get() {
+        return decorated().get();
     }
 
-    public Object remove() {
-        return getBuffer().remove();
+    public E remove() {
+        return decorated().remove();
     }
 
 }