01: /*
02: * $Id: PackageReflection.java,v 1.5 2002/09/16 08:05:03 jkl Exp $
03: *
04: * Copyright (c) 2002 Njet Communications Ltd. All Rights Reserved.
05: *
06: * Use is subject to license terms, as defined in
07: * Anvil Sofware License, Version 1.1. See LICENSE
08: * file, or http://njet.org/license-1.1.txt
09: */
10: package anvil.core.reflect;
11:
12: import java.lang.reflect.Method;
13: import java.lang.reflect.Modifier;
14: import java.util.Hashtable;
15: import java.util.Enumeration;
16: import anvil.core.Any;
17: import anvil.java.util.BindingEnumeration;
18: import anvil.script.Context;
19: import anvil.script.Type;
20: import anvil.script.ClassType;
21: import anvil.script.InterfaceRef;
22: import anvil.script.ClassRef;
23: import anvil.script.Scope;
24: import anvil.script.ReflectedJava;
25: import anvil.script.CompilableFunction;
26: import anvil.script.compiler.ResolvedClassRef;
27: import anvil.doc.Doc;
28:
29: public class PackageReflection implements ReflectedJava, Scope {
30:
31: private Hashtable _classes = new Hashtable();
32: private Package _package;
33:
34: public PackageReflection(Package pack) {
35: _package = pack;
36: }
37:
38: public void addClass(Reflection cls) {
39: _classes.put(cls.getName(), cls);
40: }
41:
42: public String getName() {
43: return _package.getName();
44: }
45:
46: public String getQualifiedName() {
47: return _package.getName();
48: }
49:
50: public int getType() {
51: return NAMESPACE;
52: }
53:
54: public Scope getParent() {
55: return null;
56: }
57:
58: public Doc getDocument() {
59: return Doc.EMPTY_DOC;
60: }
61:
62: public Enumeration getDeclarations() {
63: return _classes.elements();
64: }
65:
66: public Type lookupDeclaration(String name) {
67: return (Type) _classes.get(name);
68: }
69:
70: public int getTypeRef(anvil.codec.ConstantPool pool) {
71: return 0;
72: }
73:
74: }
|