
/*
 * Copyright 2005 The Apache Software Foundation.
 *
 * Licensed under the Apache License, Version 2.0 (the "License")
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.apache.jcs.yajcache.lang.ref;

import java.lang.ref.ReferenceQueue;
import java.lang.ref.SoftReference;
import org.apache.jcs.yajcache.lang.annotation.*;

import org.apache.jcs.yajcache.lang.annotation.*;

/**
 * Soft reference with an embedded key.
 *
 * @author Hanson Char
 */
@CopyRightApache
public class KeyedSoftReference<K,T> extends SoftReference<T> 
        implements IKey<K> 
{
    private final @NonNullable K key;
    
//    KeyedSoftRef(String key, T value) {
//	super(value);
//        this.key = key;
//    }
    public KeyedSoftReference(@NonNullable K key, @NonNullable T referrent, 
            ReferenceQueue<? super T> q) 
    {
        super(referrent, q);
        this.key = key;
    }
    @Implements(IKey.class)
    public K getKey() {
        return this.key;
    }
}

@@ -727,58 +727,8 @@
 nce;
-%0Aimport org.apache.jcs.yajcache.lang.annotation.*;
 %0A%0Aim
@@ -1003,21 +1003,26 @@
 y;%0A    %0A
-//
+ 
    
+public
  KeyedSo
@@ -1030,51 +1030,72 @@
 tRef
-(String key, T value) %7B%0A//%09super(value
+erence(@NonNullable K key, T referent) %0A    %7B%0A%09super(referent
 );%0A
-//
     
@@ -1114,18 +1114,16 @@
  = key;%0A
-//
     %7D%0A  
@@ -1169,29 +1169,16 @@
 e K key,
- @NonNullable
  T refer
@@ -1319,16 +1319,16 @@
 .class)%0A
-
     publ
@@ -1330,16 +1330,29 @@
  public 
+@NonNullable 
 K getKey

generalize + annotate