223 sb.append(map(returnType, defaultPackage));
224 return new Method(methodName, sb.toString());
225 }
226
227 private static String map(final String type, final boolean defaultPackage) {
228 if ("".equals(type)) {
229 return type;
230 }
231
232 StringBuilder sb = new StringBuilder();
233 int index = 0;
234 while ((index = type.indexOf("[]", index) + 1) > 0) {
235 sb.append('[');
236 }
237
238 String t = type.substring(0, type.length() - sb.length() * 2);
239 String desc = DESCRIPTORS.get(t);
240 if (desc != null) {
241 sb.append(desc);
242 } else {
243 sb.append('L');
244 if (t.indexOf('.') < 0) {
245 if (!defaultPackage) {
246 sb.append("java/lang/");
247 }
248 sb.append(t);
249 } else {
250 sb.append(t.replace('.', '/'));
251 }
252 sb.append(';');
253 }
254 return sb.toString();
255 }
256
257 /**
258 * Returns the name of the method described by this object.
259 *
260 * @return the name of the method described by this object.
261 */
262 public String getName() {
|
223 sb.append(map(returnType, defaultPackage));
224 return new Method(methodName, sb.toString());
225 }
226
227 private static String map(final String type, final boolean defaultPackage) {
228 if ("".equals(type)) {
229 return type;
230 }
231
232 StringBuilder sb = new StringBuilder();
233 int index = 0;
234 while ((index = type.indexOf("[]", index) + 1) > 0) {
235 sb.append('[');
236 }
237
238 String t = type.substring(0, type.length() - sb.length() * 2);
239 String desc = DESCRIPTORS.get(t);
240 if (desc != null) {
241 sb.append(desc);
242 } else {
243 // FIXME: support Q-type
244 sb.append('L');
245 if (t.indexOf('.') < 0) {
246 if (!defaultPackage) {
247 sb.append("java/lang/");
248 }
249 sb.append(t);
250 } else {
251 sb.append(t.replace('.', '/'));
252 }
253 sb.append(';');
254 }
255 return sb.toString();
256 }
257
258 /**
259 * Returns the name of the method described by this object.
260 *
261 * @return the name of the method described by this object.
262 */
263 public String getName() {
|