/[classpath]/classpath/vm/reference/java/lang/VMClass.java
ViewVC logotype

Diff of /classpath/vm/reference/java/lang/VMClass.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.10.2.4 by gnu_andrew, Thu Apr 28 23:00:15 2005 UTC revision 1.10.2.5 by gnu_andrew, Fri May 6 00:54:18 2005 UTC
# Line 329  final class VMClass Line 329  final class VMClass
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

Legend:
Removed from v.1.10.2.4  
changed lines
  Added in v.1.10.2.5

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26