1 /** 2 * Copyright (C) 2006 Google Inc. 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 17 package com.google.inject.util; 18 19 /** 20 * Reference type. Used to specify what type of reference to keep to a 21 * referent. 22 * 23 * @see java.lang.ref.Reference 24 * @author crazybob@google.com (Bob Lee) 25 */ 26 public enum ReferenceType { 27 28 /** 29 * Prevents referent from being reclaimed by the garbage collector. 30 */ 31 STRONG, 32 33 /** 34 * Referent reclaimed in an LRU fashion when the VM runs low on memory and 35 * no strong references exist. 36 * 37 * @see java.lang.ref.SoftReference 38 */ 39 SOFT, 40 41 /** 42 * Referent reclaimed when no strong or soft references exist. 43 * 44 * @see java.lang.ref.WeakReference 45 */ 46 WEAK, 47 48 /** 49 * Similar to weak references except the garbage collector doesn't actually 50 * reclaim the referent. More flexible alternative to finalization. 51 * 52 * @see java.lang.ref.PhantomReference 53 */ 54 PHANTOM; 55 } 56