01: package net.sourceforge.jaxor.parser;
02:
03: import com.thoughtworks.qdox.model.JavaClass;
04:
05: import java.io.File;
06: import java.util.HashMap;
07: import java.util.Map;
08:
09: /**
10: * Created By: Mike
11: * Date: Dec 9, 2003
12: * Time: 10:38:53 PM
13: *
14: * Last Checkin: $Author: mrettig $
15: * Date: $Date: 2004/01/21 04:09:52 $
16: * Revision: $Revision: 1.3 $
17: */
18: public class SourceMap {
19: private final Map map = new HashMap();
20:
21: public void put(JavaClass aClass, File file) {
22: map.put(aClass.asClassNamespace(), new Entry(aClass, file));
23: }
24:
25: public void put(SourceMap source) {
26: map.putAll(source.map);
27: }
28:
29: public JavaClass get(String impl) {
30: Entry en = (Entry) map.get(impl);
31: if (en != null)
32: return en.theClass;
33: return null;
34: }
35:
36: public long getTimestamp(String impl) {
37: Entry en = (Entry) map.get(impl);
38: if (en == null)
39: return -1;
40: return en.sourceFile.lastModified();
41: }
42:
43: public static class Entry {
44: public JavaClass theClass;
45: public File sourceFile;
46:
47: public Entry(JavaClass aClass, File file) {
48: theClass = aClass;
49: sourceFile = file;
50: }
51: }
52: }
|