1 29 30 package com.caucho.bytecode; 31 32 35 public class JClassArray extends JClass { 36 private JClass _componentType; 37 38 JClassArray(JClass component) 39 { 40 if (component == null) 41 throw new NullPointerException (); 42 43 _componentType = component; 44 } 45 46 49 public String getName() 50 { 51 return "[" + _componentType.getName(); 52 } 53 54 57 public boolean isPrimitive() 58 { 59 return false; 60 } 61 62 65 public boolean isPublic() 66 { 67 return true; 68 } 69 70 73 public boolean isAbstract() 74 { 75 return false; 76 } 77 78 81 public boolean isFinal() 82 { 83 return true; 84 } 85 86 89 public boolean isInterface() 90 { 91 return false; 92 } 93 94 97 public JClass getSuperClass() 98 { 99 return JClass.OBJECT; 100 } 101 102 105 public JClass []getInterfaces() 106 { 107 return new JClass[0]; 108 } 109 110 113 public JMethod []getConstructors() 114 { 115 return new JMethod[0]; 116 } 117 118 121 public boolean isArray() 122 { 123 return true; 124 } 125 126 129 public JClass getComponentType() 130 { 131 return _componentType; 132 } 133 134 137 public boolean isAssignableTo(Class cl) 138 { 139 return getName().equals(cl.getName()); 140 } 141 142 145 public boolean isAssignableFrom(Class cl) 146 { 147 return getName().equals(cl.getName()); 148 } 149 150 153 public boolean isAssignableFrom(JClass cl) 154 { 155 return getName().equals(cl.getName()); 156 } 157 158 161 public JMethod []getDeclaredMethods() 162 { 163 return new JMethod[0]; 164 } 165 166 169 public JMethod []getMethods() 170 { 171 return new JMethod[0]; 172 } 173 174 177 public JMethod getMethod(String name, JClass []param) 178 { 179 return null; 180 } 181 182 185 public JField []getDeclaredFields() 186 { 187 return new JField[0]; 188 } 189 190 193 public JField []getFields() 194 { 195 return new JField[0]; 196 } 197 198 201 public String getPrintName() 202 { 203 if (isArray()) 204 return getComponentType().getPrintName() + "[]"; 205 else 206 return getName(); 207 } 208 209 212 public String getShortName() 213 { 214 if (isArray()) 215 return getComponentType().getShortName() + "[]"; 216 else { 217 String name = getName(); 218 219 int p = name.lastIndexOf('.'); 220 221 if (p >= 0) 222 return name.substring(p + 1); 223 else 224 return name; 225 } 226 } 227 228 231 public int hashCode() 232 { 233 return getName().hashCode(); 234 } 235 236 239 public boolean equals(Object o) 240 { 241 if (o == this) 242 return true; 243 else if (o == null || getClass() != o.getClass()) 244 return false; 245 246 JClass jClass = (JClass) o; 247 248 return getName().equals(jClass.getName()); 250 } 251 252 public String toString() 253 { 254 return "JClass[" + getName() + "]"; 255 } 256 } 257 | Popular Tags |