Java Class Simple Name Get simpleClassName(Class type)

Here you can find the source of simpleClassName(Class type)

Description

simple Class Name

License

Open Source License

Declaration

public static String simpleClassName(Class<?> type) 

Method Source Code

//package com.java2s;
/*//w  ww  . ja v a 2s  . co  m
 * Copyright (c) 2006 Rick Mugridge, www.RimuResearch.com
 * Released under the terms of the GNU General Public License version 2 or later.
 */

public class Main {
    public static String simpleClassName(Class<?> type) { // use
        // Class.getSimpleName()
        // in jdk1.5
        String className = type.getName();
        int dot = className.lastIndexOf(".");
        if (dot >= 0)
            className = className.substring(dot + 1);
        dot = className.lastIndexOf("$");
        if (dot >= 0)
            className = className.substring(dot + 1);
        return className;
    }
}

Related

  1. simpleClassName(Class cl)
  2. simpleClassName(Class klass)
  3. simpleClassName(Class clazz)
  4. simpleClassName(Class clazz)
  5. simpleClassName(Class clazz)
  6. simpleClassName(final String className)
  7. simpleClassName(Object o)
  8. simpleClassName(Object o)
  9. simpleClassName(Object object)