View Javadoc

1   /*
2    * Copyright 2001-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.cache.adt;
17  
18  /**
19   * A simple {@link Listable} supporting doubly-linked
20   * lists of arbitrary {@link Object}s.
21   *
22   * @version $Id: WListableObject.java 155435 2005-02-26 13:17:27Z dirkv $
23   * @author Rodney Waldhoff
24   */
25  public class WListableObject extends WListableBase implements Listable, Cloneable {
26    /**
27     * Equivalent to {@link #WListableObject(java.lang.Object,Listable,Listable) <tt>WListableObject(val,null,null)</tt>}.
28     */
29    public WListableObject(Object val) {
30      this(val,null,null);
31    }
32  
33    /**
34     * @param val my value
35     * @param next the next Listable.
36     */
37    public WListableObject(Object val, Listable prev, Listable next) {
38      super(prev,next);
39      _val = val;
40    }
41  
42    /** My value. */
43    protected Object _val = null;
44  
45    /**
46     * Return the {@link Object} I'm wrapping.
47     * @return the {@link Object} I'm wrapping.
48     */
49    public Object getValue() {
50      return _val;
51    }
52  
53    /**
54     * Set the {@link Object} I'm wrapping.
55     * @param the {@link Object} to wrap.
56     */
57    public void setValue(Object obj) {
58      _val = obj;
59    }
60  }