Example usage for java.lang Class getSimpleName

List of usage examples for java.lang Class getSimpleName

Introduction

In this page you can find the example usage for java.lang Class getSimpleName.

Prototype

public String getSimpleName() 

Source Link

Document

Returns the simple name of the underlying class as given in the source code.

Usage

From source file:Main.java

public static String simpleName(@NonNull final Class cls) {
    return cls.getSimpleName();
}

From source file:Main.java

public static void log(Class tag, String msg) {
    Log.i(tag.getSimpleName(), msg);
}

From source file:Main.java

public static String getTagClass(Class<? extends Object> classObject) {
    return classObject.getSimpleName();
}

From source file:Main.java

public static String getThreadName(Object who, int instanceCount) {
    Class<?> objClass = who.getClass();
    return objClass.getSimpleName() + "_" + getHashCode(who) + "_" + instanceCount;
}

From source file:Main.java

public static String createThreadLabel(String prefix, Class<?> clazz, String purpose) {
    return prefix + clazz.getSimpleName() + " :: " + purpose;
}

From source file:Main.java

/**
 * WARNING: Don't use this when obfuscating class names with Proguard!
 *//*from w  ww  .j a v a2s. com*/
public static String makeLogTag(Class<?> cls) {
    return makeLogTag(cls.getSimpleName());
}

From source file:Main.java

@SuppressWarnings("unchecked")
public static String makeLogTag(Class cls) {
    return "Androidpn_" + cls.getSimpleName();
}

From source file:Main.java

public static String getComponentSimpleName(Class<? extends Object> clazz) {
    return clazz.getSimpleName();
}

From source file:Main.java

private static <T> Class<T> findClass(String className, Class<?>[] declaredClasses) {
    for (Class<?> klass : declaredClasses) {
        if (klass.getSimpleName().matches(className)) {
            return (Class<T>) klass;
        }/*  w  w  w . j  av  a2s  . c  om*/
    }
    throw new IllegalArgumentException(String.format("Class name %s not found ", className));
}

From source file:Main.java

private static String getSimplifiedClassName(Class<?> klass) {
    String className = klass.getSimpleName();
    if (className.endsWith("Impl")) {
        className = className.substring(0, className.lastIndexOf("Impl"));
    }/*  w  w w.  j  a va  2  s  .  c om*/
    return className;
}