01: /*
02: * @(#)LimitedClassesConfiguration.java 1.2 04/12/06
03: *
04: * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
05: *
06: * See the file "LICENSE.txt" for information on usage and redistribution of
07: * this file, and for a DISCLAIMER OF ALL WARRANTIES.
08: */
09: package pnuts.ext;
10:
11: import pnuts.lang.*;
12: import java.util.*;
13: import java.lang.reflect.*;
14:
15: public class LimitedClassesConfiguration extends ConfigurationAdapter {
16:
17: private HashSet set = new HashSet();
18:
19: public LimitedClassesConfiguration() {
20: }
21:
22: public LimitedClassesConfiguration(Configuration base) {
23: super (base);
24: }
25:
26: public void registerClass(Class cls) {
27: set.add(cls);
28: }
29:
30: public Method[] getMethods(Class cls) {
31: if (set.contains(cls)) {
32: return super .getMethods(cls);
33: } else {
34: return new Method[] {};
35: }
36: }
37:
38: public Constructor[] getConstructors(Class cls) {
39: if (set.contains(cls)) {
40: return super .getConstructors(cls);
41: } else {
42: return new Constructor[] {};
43: }
44: }
45: }
|