X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Forg%2Fibex%2Fclassgen%2FContext.java;fp=src%2Forg%2Fibex%2Fclassgen%2FContext.java;h=99d98190a802b4c562ca4438ea4f2c69afc4bc9a;hb=e364eb71c265255d2843ef8752a30c854f56fefb;hp=0000000000000000000000000000000000000000;hpb=0af18e327981bdae42ca0753ca05b4030bbdc848;p=org.ibex.classgen.git diff --git a/src/org/ibex/classgen/Context.java b/src/org/ibex/classgen/Context.java new file mode 100644 index 0000000..99d9819 --- /dev/null +++ b/src/org/ibex/classgen/Context.java @@ -0,0 +1,20 @@ +package org.ibex.classgen; +import java.util.*; + +/** + * a Context is like a ClassLoader in that it maps from class names + * to bytecode-implementations of classes, except that it doesn't + * actually load the resolved class -- it simply creates a (cached) + * ClassFile for it. + */ +public class Context { + + private Hashtable cache = new Hashtable(); + + public Context() { } + + public void add(ClassFile cf) { cache.put(cf.getType().getName(), cf); } + public Collection enumerateClassFiles() { return cache.values(); } + public ClassFile resolve(String classname) { return (ClassFile)cache.get(classname); } + +}