01: /*
02: * @(#)CalendarCache.java 1.2 04/12/06
03: *
04: * Copyright (c) 1997-2004 Sun Microsystems, Inc. All Rights Reserved.
05: *
06: * See the file "LICENSE.txt" for information on usage and redistribution
07: * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
08: */
09: package org.pnuts.lib;
10:
11: import pnuts.lang.Context;
12: import java.util.Date;
13: import java.util.Calendar;
14:
15: class CalendarCache extends ResourceCache {
16: private final static boolean DEBUG = false;
17:
18: Context context;
19:
20: CalendarCache(Context context) {
21: this .context = context;
22: }
23:
24: protected Object createResource(Object key) {
25: if (DEBUG) {
26: System.out.println("createResource " + key);
27: }
28: Calendar c = Calendar.getInstance(date.getTimeZone(context),
29: locale.getLocale(context));
30: c.setTime((Date) key);
31: return c;
32: }
33:
34: Calendar get(Date date) {
35: return (Calendar) super.getResource(date);
36: }
37: }
|