1 7 8 package java.lang.reflect; 9 10 import sun.reflect.MethodAccessor; 11 import sun.reflect.ConstructorAccessor; 12 13 16 17 class ReflectAccess implements sun.reflect.LangReflectAccess { 18 public Field newField(Class declaringClass, 19 String name, 20 Class type, 21 int modifiers, 22 int slot, 23 String signature, 24 byte[] annotations) 25 { 26 return new Field (declaringClass, 27 name, 28 type, 29 modifiers, 30 slot, 31 signature, 32 annotations); 33 } 34 35 public Method newMethod(Class declaringClass, 36 String name, 37 Class [] parameterTypes, 38 Class returnType, 39 Class [] checkedExceptions, 40 int modifiers, 41 int slot, 42 String signature, 43 byte[] annotations, 44 byte[] parameterAnnotations, 45 byte[] annotationDefault) 46 { 47 return new Method (declaringClass, 48 name, 49 parameterTypes, 50 returnType, 51 checkedExceptions, 52 modifiers, 53 slot, 54 signature, 55 annotations, 56 parameterAnnotations, 57 annotationDefault); 58 } 59 60 public <T> Constructor <T> newConstructor(Class <T> declaringClass, 61 Class [] parameterTypes, 62 Class [] checkedExceptions, 63 int modifiers, 64 int slot, 65 String signature, 66 byte[] annotations, 67 byte[] parameterAnnotations) 68 { 69 return new Constructor <T>(declaringClass, 70 parameterTypes, 71 checkedExceptions, 72 modifiers, 73 slot, 74 signature, 75 annotations, 76 parameterAnnotations); 77 } 78 79 public MethodAccessor getMethodAccessor(Method m) { 80 return m.getMethodAccessor(); 81 } 82 83 public void setMethodAccessor(Method m, MethodAccessor accessor) { 84 m.setMethodAccessor(accessor); 85 } 86 87 public ConstructorAccessor getConstructorAccessor(Constructor c) { 88 return c.getConstructorAccessor(); 89 } 90 91 public void setConstructorAccessor(Constructor c, 92 ConstructorAccessor accessor) 93 { 94 c.setConstructorAccessor(accessor); 95 } 96 97 public int getConstructorSlot(Constructor c) { 98 return c.getSlot(); 99 } 100 101 public String getConstructorSignature(Constructor c) { 102 return c.getSignature(); 103 } 104 105 public byte[] getConstructorAnnotations(Constructor c) { 106 return c.getRawAnnotations(); 107 } 108 109 public byte[] getConstructorParameterAnnotations(Constructor c) { 110 return c.getRawParameterAnnotations(); 111 } 112 113 public Method copyMethod(Method arg) { 118 return arg.copy(); 119 } 120 121 public Field copyField(Field arg) { 122 return arg.copy(); 123 } 124 125 public <T> Constructor <T> copyConstructor(Constructor <T> arg) { 126 return arg.copy(); 127 } 128 } 129 | Popular Tags |