Example usage for java.lang Class getCanonicalName

List of usage examples for java.lang Class getCanonicalName

Introduction

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

Prototype

public String getCanonicalName() 

Source Link

Document

Returns the canonical name of the underlying class as defined by the Java Language Specification.

Usage

From source file:Main.java

public static String canonicalName(@NonNull final Class cls) {
    return cls.getCanonicalName();
}

From source file:Main.java

private static String getPrettyClassName(Class<?> clazz) {
    String name = clazz.getCanonicalName();
    if (name == null) {
        name = clazz.getName();//from   w w  w .ja  v a2 s. c o  m
    }
    return name;
}

From source file:Main.java

/**
 * Make a component specific extra name//from ww w.  ja va 2s  .c  o m
 *
 * @param clazz the class.
 * @param name the extra key.
 * @return an extra key
 */
public static String makeExtraKey(final Class<?> clazz, final String name) {
    return clazz.getCanonicalName() + "." + name;
}

From source file:Main.java

public static boolean isDbPrimitiveType(Class<?> fieldType) {
    return DB_PRIMITIVE_TYPES.contains(fieldType.getCanonicalName());
}

From source file:Main.java

public static String getPlainName(Class<?> type) {
    String typeName = type.getCanonicalName();
    if (typeName == null) {
        typeName = type.getName().replace('$', '.');
    }//  www .j a va2  s  . com
    return getPlainName(typeName);
}

From source file:Main.java

public static String buildKey(Class<?> clazz, String name) {
    return new StringBuilder().append(clazz.getCanonicalName()).append(".").append(name).toString();
}

From source file:Main.java

public static boolean bundleContains(Bundle bundle, Class<? extends Serializable> aClass) {
    return bundle != null && bundle.containsKey(aClass.getCanonicalName());
}

From source file:com.boozallen.cognition.test.utils.TestResourceUtils.java

static String getResourcePath(Class<?> testClass, String resource) {
    String canonicalName = testClass.getCanonicalName();
    String folder = canonicalName.replaceAll("\\.", "/");
    return String.format("/%s/%s", folder, resource);
}

From source file:Main.java

/**
 * Check out if it is a super interface of child
 * @param child child class type/*from  w  w w.j ava  2  s .  c o  m*/
 * @param sup the super interface class name
 * @return true if it is super interface or itself
 */
public static boolean isSuperInterface(Class child, String sup) {
    if (child == null)
        return false;
    if (child.getCanonicalName().equals(sup))
        return true;

    Class[] interfaces = child.getInterfaces();
    for (Class in : interfaces) {
        if (in.getCanonicalName().equals(sup)) {
            return true;
        }
    }
    return false;
}

From source file:de.unisb.cs.st.javalanche.mutation.testutil.TestUtil.java

public static List<Mutation> getMutationsForClazzOnClasspath(Class<?> clazz) throws IOException {
    String fileName = clazz.getCanonicalName().replace('.', '/') + ".class";
    InputStream is = TestUtil.class.getClassLoader().getResourceAsStream(fileName);
    byte[] byteArray = IOUtils.toByteArray(is);
    return getMutations(byteArray, clazz.getCanonicalName());
}