Get non Package Qualified Name : Class Method Field Name « Reflection « Java

Get non Package Qualified Name


public class Utils {

  public static String nonPackageQualifiedName( final Class<?> clazz ) {

      String name = clazz.getName();
      return name.substring(name.lastIndexOf('.') + 1);



Related examples in the same category

1.Create a new instance given a class name
2.Load a class given its name.
3.Get the short name of the specified class by striping off the package name.
4.Returns an instance of the given class name, by calling the default constructor.
5.Returns the name of a class without the package name
6.Returns the package portion of the specified class
7.Format a string buffer containing the Class, Interfaces, CodeSource, and ClassLoader information for the given object clazz.
8.Create a unique hash for Constructor and method