1 29 30 package com.caucho.bytecode; 31 32 import com.caucho.util.CharBuffer; 33 34 37 public class JavaParameterizedType implements JType { 38 private JClassLoader _loader; 39 private JClass _rawClass; 40 private JType []_typeArgs; 41 42 JavaParameterizedType(JClassLoader loader, JClass rawClass, JType []args) 43 { 44 _loader = loader; 45 _rawClass = rawClass; 46 _typeArgs = args; 47 } 48 49 52 public String getName() 53 { 54 return _rawClass.getName(); 55 } 56 57 60 public String getPrintName() 61 { 62 if (_typeArgs.length == 0) 63 return _rawClass.getPrintName(); 64 65 CharBuffer cb = new CharBuffer(); 66 cb.append(_rawClass.getPrintName()); 67 cb.append('<'); 68 for (int i = 0; i < _typeArgs.length; i++) { 69 if (i != 0) 70 cb.append(','); 71 72 cb.append(_typeArgs[i].getPrintName()); 73 } 74 75 cb.append('>'); 76 77 return cb.toString(); 78 } 79 80 83 public JType []getActualTypeArguments() 84 { 85 return _typeArgs; 86 } 87 88 91 public JClass getRawType() 92 { 93 return _rawClass; 94 } 95 96 99 public boolean isPrimitive() 100 { 101 return _rawClass.isPrimitive(); 102 } 103 104 107 public boolean isPublic() 108 { 109 return _rawClass.isPublic(); 110 } 111 112 115 public boolean isAbstract() 116 { 117 return _rawClass.isAbstract(); 118 } 119 120 123 public boolean isFinal() 124 { 125 return _rawClass.isFinal(); 126 } 127 128 131 public boolean isInterface() 132 { 133 return _rawClass.isAbstract(); 134 } 135 136 139 public JClass getSuperClass() 140 { 141 return _rawClass.getSuperClass(); 142 } 143 144 147 public JClass []getInterfaces() 148 { 149 return _rawClass.getInterfaces(); 150 } 151 152 155 public boolean isArray() 156 { 157 return _rawClass.isArray(); 158 } 159 160 163 public JClass getComponentType() 164 { 165 return null; 166 } 167 168 171 public boolean isAssignableTo(Class cl) 172 { 173 return _rawClass.isAssignableTo(cl); 174 } 175 176 179 public boolean isAssignableFrom(Class cl) 180 { 181 return _rawClass.isAssignableFrom(cl); 182 } 183 184 187 public boolean isAssignableFrom(JClass cl) 188 { 189 return _rawClass.isAssignableFrom(cl); 190 } 191 192 195 public JMethod []getDeclaredMethods() 196 { 197 return _rawClass.getDeclaredMethods(); 198 } 199 200 203 public JMethod []getMethods() 204 { 205 return _rawClass.getMethods(); 206 } 207 208 211 public JMethod getMethod(String name, JClass []param) 212 { 213 return _rawClass.getMethod(name, param); 214 } 215 216 219 public JField []getDeclaredFields() 220 { 221 return _rawClass.getDeclaredFields(); 222 } 223 224 227 public JField []getFields() 228 { 229 return _rawClass.getFields(); 230 } 231 } 232 | Popular Tags |