1 29 30 package com.caucho.bytecode; 31 32 import java.lang.reflect.Constructor ; 33 import java.lang.reflect.Modifier ; 34 35 38 public class JConstructorWrapper extends JMethod { 39 private JClassLoader _loader; 40 41 private Constructor _method; 42 43 public JConstructorWrapper(Constructor method, JClassLoader loader) 44 { 45 if (loader == null) 46 throw new NullPointerException (); 47 48 _method = method; 49 _loader = loader; 50 } 51 52 55 public String getName() 56 { 57 return _method.getName(); 58 } 59 60 63 public boolean isStatic() 64 { 65 return Modifier.isStatic(_method.getModifiers()); 66 } 67 68 71 public boolean isPrivate() 72 { 73 return Modifier.isPrivate(_method.getModifiers()); 74 } 75 76 79 public boolean isPublic() 80 { 81 return Modifier.isPublic(_method.getModifiers()); 82 } 83 84 87 public boolean isFinal() 88 { 89 return Modifier.isFinal(_method.getModifiers()); 90 } 91 92 95 public boolean isAbstract() 96 { 97 return Modifier.isAbstract(_method.getModifiers()); 98 } 99 100 103 public JClass getDeclaringClass() 104 { 105 return _loader.forName(_method.getDeclaringClass().getName()); 106 } 107 108 111 public JClass getReturnType() 112 { 113 throw new UnsupportedOperationException (); 114 } 115 116 119 public JType getGenericReturnType() 120 { 121 throw new UnsupportedOperationException (); 122 } 123 124 127 public JClass []getParameterTypes() 128 { 129 Class []types = _method.getParameterTypes(); 130 131 JClass []jTypes = new JClass[types.length]; 132 133 for (int i = 0; i < types.length; i++) { 134 jTypes[i] = _loader.forName(types[i].getName()); 135 } 136 137 return jTypes; 138 } 139 140 143 public JClass []getExceptionTypes() 144 { 145 Class []types = _method.getExceptionTypes(); 146 147 JClass []jTypes = new JClass[types.length]; 148 149 for (int i = 0; i < types.length; i++) { 150 jTypes[i] = _loader.forName(types[i].getName()); 151 } 152 153 return jTypes; 154 } 155 156 159 public JAnnotation []getDeclaredAnnotations() 160 { 161 return new JAnnotation[0]; 162 } 163 } 164 | Popular Tags |