329 |
*/ |
*/ |
330 |
static native boolean isEnum(Class klass); |
static native boolean isEnum(Class klass); |
331 |
|
|
332 |
|
/** |
333 |
|
* Returns the simple name for this class, as used in the source |
334 |
|
* code. For normal classes, this is the content returned by |
335 |
|
* <code>getName()</code> which follows the last ".". Anonymous |
336 |
|
* classes have no name, and so the result of calling this method is |
337 |
|
* "". The simple name of an array consists of the simple name of |
338 |
|
* its component type, followed by "[]". Thus, an array with the |
339 |
|
* component type of an anonymous class has a simple name of simply |
340 |
|
* "[]". |
341 |
|
* |
342 |
|
* @return the simple name for this class. |
343 |
|
*/ |
344 |
|
static String getSimpleName(Class klass) |
345 |
|
{ |
346 |
|
if (klass.isArray()) |
347 |
|
{ |
348 |
|
return klass.getComponentType().getSimpleName() + "[]"; |
349 |
|
} |
350 |
|
String fullName = klass.getName(); |
351 |
|
return fullName.substring(fullName.lastIndexOf(".") + 1); |
352 |
|
} |
353 |
|
|
354 |
} // class VMClass |
} // class VMClass |