View Javadoc

1   /*
2    * Copyright (c) 2004-2005, University Health Network.  All rights reserved. Distributed under the BSD 
3    * license (see http://opensource.org/licenses/bsd-license.php).
4    *  
5    * Created on 29-Nov-2004
6    */
7   package ca.uhn.cache;
8   
9   import java.util.List;
10  
11  import org.apache.commons.lang.enum.Enum;
12  
13  
14  /***
15   * Type safe codes for reasons for caching data. 
16   * 
17   * @author <a href="mailto:bryan.tripp@uhn.on.ca">Bryan Tripp</a>
18   * @version $Revision: 1.1 $ updated on $Date: 2005/01/24 22:52:08 $ by $Author: bryan_tripp $
19   */
20  public class CacheReasonEnum extends Enum {
21      
22      /***
23       * Describes cached data that are in the cache because they have been 
24       * queried by a user.    
25       */
26      public static final CacheReasonEnum QUERY = new CacheReasonEnum("query");
27  
28      /***
29       * Describes cached data that are in the cache because they have been 
30       * pre-fetched. 
31       */
32      public static final CacheReasonEnum PRE_FETCH = new CacheReasonEnum("pre-fetch");
33  
34      protected CacheReasonEnum(String theName) {
35          super(theName);
36      }
37      
38      /***
39       * @param theName name of desired <code>CacheReasonEnum</code>
40       * @return <code>CacheReasonEnum</code> that has the given name.
41       */
42      public static CacheReasonEnum getEnum(String theName) {
43          return (CacheReasonEnum) getEnum(
44                  CacheReasonEnum.class, theName);
45      }
46      
47      /***
48       * @return List of all <code>CacheReasonEnum</code>.
49       */
50      public static List getEnumList() {
51          return getEnumList(CacheReasonEnum.class);
52      }
53      
54  }