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 void e(Class<?> clazz, String message) {
    String tag = clazz.getSimpleName();
    e(tag, message);
}

From source file:Main.java

/**
 * Print class name and its parent name of an object
 *
 * @param obj//from   w w  w  .j  a v  a2  s . c  o m
 */
public final static String getClassInheritence(Object obj) {
    if (obj == null) {
        return null;
    }
    StringBuilder stb = new StringBuilder();
    Class<?> cls = obj.getClass();
    String name = cls.getSimpleName();
    stb.append("[");
    stb.append(String.valueOf(obj));
    stb.append(":");
    while (!name.toLowerCase().equals("object")) {
        stb.append(name);
        stb.append("<-");
        cls = cls.getSuperclass();
        name = cls.getSimpleName();
    }
    stb.append("]");
    return stb.toString();
}

From source file:Main.java

public static void printLogRequest(Class<?> c, String url, String data) {
    if (enableDebug) {
        Log.e(c.getSimpleName(), "url/data: " + url + "/" + data);
    }/*from w  w w . j a v  a2 s.c o m*/
}

From source file:Main.java

/**
 * Removes object from the bundle.// w w w .ja v a  2  s.  c o m
 *
 * @param clazz  of object
 * @param bundle to get from
 * @param <T>    type of object
 */
public static <T> void removeFromBundle(Class<T> clazz, Bundle bundle) {
    if (bundle != null) {
        bundle.remove(clazz.getSimpleName());
    }
}

From source file:io.servicecomb.springboot.starter.configuration.CseDelegatingProxyUtils.java

public static <T> T getInstanceWithPrefix(Class<T> type, String prefix) {
    String name = prefix + type.getSimpleName();
    return getNamedInstance(type, name);
}

From source file:Main.java

public static void d(Class<?> clazz, String message) {
    String tag = clazz.getSimpleName();
    d(tag, message);
}

From source file:com.amazonaws.logging.LogFactory.java

/**
 * Get the logger for the clazz//w  ww  . j  a  v  a2 s.c  o  m
 * @param clazz the class object
 *
 * @return logger
 */
public static synchronized Log getLog(Class clazz) {
    return getLog(clazz.getSimpleName());
}

From source file:Main.java

public static Class<?> messageClass(Object message) {

    final Class<?> messageClass = message.getClass();

    if (messageClass.isAnonymousClass() || messageClass.getSimpleName().contains("-$Lambda$") // Jack
            || messageClass.getSimpleName().contains("$$Lambda$") // Retrolambda
    )/*from  w  w  w  . j  a va2s  .  co  m*/
        return messageClass.getInterfaces()[0];

    return messageClass;
}

From source file:mojo.view.util.SpringUtils.java

@SuppressWarnings("unchecked")
public static <T> T getComponent(Class<?> klass) {
    String name = Introspector.decapitalize(klass.getSimpleName());
    return (T) applicationContext.getBean(name);
}

From source file:com.jdom.util.TestUtil.java

public static File getTestClassDir(Class<?> testClass) {
    File testDir = new File(JAVA_IO_TMPDIR, testClass.getSimpleName());
    if (testDir.exists()) {
        try {/*from   w w  w  .ja va2s  .c  om*/
            FileUtils.deleteDirectory(testDir);
        } catch (IOException e) {
            throw new IllegalStateException(e);
        }
    }

    return testDir;
}