Java Class Name Get className(final Object object)

Here you can find the source of className(final Object object)

Description

Returns the class name of the specified object, excluding its path.

License

BSD License

Parameter

Parameter Description
object object

Return

class name

Declaration

public static String className(final Object object) 

Method Source Code

//package com.java2s;
/**/*from  w  w w.  j a v  a2s  .c o  m*/
 * This class contains static methods, which are used throughout the project.
 * The methods are used for dumping error output, debugging information,
 * getting the application path, etc.
 *
 * @author BaseX Team 2005-17, BSD License
 * @author Christian Gruen
 */

public class Main {
    /**
     * Returns the class name of the specified object, excluding its path.
     * @param object object
     * @return class name
     */
    public static String className(final Object object) {
        return className(object.getClass());
    }

    /**
     * Returns the name of the specified class, excluding its path.
     * @param clazz class
     * @return class name
     */
    public static String className(final Class<?> clazz) {
        return clazz.getSimpleName();
    }
}

Related

  1. classname(Class javaClass)
  2. className(Class type)
  3. className(Class aClass)
  4. className(final Class c)
  5. className(Object o)
  6. className(Object o)
  7. classname(Object obj)
  8. className(Object obj)