| 1 8 9 package test.javax.management.compliance.signature.support; 10 11 14 public interface ObjectClass 15 { 16 public String getName(); 17 18 public ObjectMethod[] getDeclaredMethods(); 19 20 public ObjectMethod[] getMethods(); 21 22 public ObjectClass getSuperclass(); 23 24 public static class Constructor implements ObjectClass 25 { 26 private java.lang.Class cls; 27 28 public Constructor(Class cls) 29 { 30 this.cls = cls; 31 } 32 33 public String getName() 34 { 35 return cls.getName(); 36 } 37 38 public ObjectMethod[] getDeclaredMethods() 39 { 40 java.lang.reflect.Constructor [] constructors = cls.getDeclaredConstructors(); 41 ObjectMethod[] ctors = new ObjectMethod[constructors.length]; 42 for (int i = 0; i < ctors.length; ++i) ctors[i] = new ObjectMethod.Constructor(constructors[i]); 43 return ctors; 44 } 45 46 public ObjectMethod[] getMethods() 47 { 48 java.lang.reflect.Constructor [] constructors = cls.getConstructors(); 49 ObjectMethod[] ctors = new ObjectMethod[constructors.length]; 50 for (int i = 0; i < ctors.length; ++i) ctors[i] = new ObjectMethod.Constructor(constructors[i]); 51 return ctors; 52 } 53 54 public ObjectClass getSuperclass() 55 { 56 Class superCls = cls.getSuperclass(); 57 return superCls == null ? null : new Constructor(superCls); 58 } 59 } 60 61 public static class Method implements ObjectClass 62 { 63 private java.lang.Class cls; 64 65 public Method(Class cls) 66 { 67 this.cls = cls; 68 } 69 70 public String getName() 71 { 72 return cls.getName(); 73 } 74 75 public ObjectMethod[] getDeclaredMethods() 76 { 77 java.lang.reflect.Method [] methods = cls.getDeclaredMethods(); 78 ObjectMethod[] mthds = new ObjectMethod[methods.length]; 79 for (int i = 0; i < mthds.length; ++i) mthds[i] = new ObjectMethod.Method(methods[i]); 80 return mthds; 81 } 82 83 public ObjectMethod[] getMethods() 84 { 85 java.lang.reflect.Method [] methods = cls.getMethods(); 86 ObjectMethod[] mthds = new ObjectMethod[methods.length]; 87 for (int i = 0; i < mthds.length; ++i) mthds[i] = new ObjectMethod.Method(methods[i]); 88 return mthds; 89 } 90 91 public ObjectClass getSuperclass() 92 { 93 Class superCls = cls.getSuperclass(); 94 return superCls == null ? null : new Method(superCls); 95 } 96 } 97 } 98 | Popular Tags |