1 32 33 package com.jeantessier.classreader; 34 35 import java.io.*; 36 import java.util.*; 37 38 public class AggregatingClassfileLoader extends ClassfileLoaderEventSource { 39 private Map classfiles = new TreeMap(); 40 41 public AggregatingClassfileLoader() { 42 super(); 43 } 44 45 public AggregatingClassfileLoader(ClassfileLoaderDispatcher dispatcher) { 46 super(dispatcher); 47 } 48 49 public Classfile getClassfile(String name) { 50 return (Classfile) classfiles.get(name); 51 } 52 53 public Collection getAllClassfiles() { 54 return Collections.unmodifiableCollection(classfiles.values()); 55 } 56 57 public Collection getAllClassNames() { 58 return Collections.unmodifiableCollection(classfiles.keySet()); 59 } 60 61 protected Classfile load(DataInputStream in) throws IOException { 62 Classfile result = new Classfile(this, in); 63 64 classfiles.put(result.getClassName(), result); 65 66 return result; 67 } 68 } 69 | Popular Tags |