Example usage for java.lang Class getName

List of usage examples for java.lang Class getName

Introduction

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

Prototype

public String getName() 

Source Link

Document

Returns the name of the entity (class, interface, array class, primitive type, or void) represented by this Class object, as a String .

Usage

From source file:Main.java

private static boolean equalsType(Field type, Class<?>... cls) {
    for (int i = 0; i < cls.length; i++) {
        Class<?> mClass = cls[i];
        if (type.getType().getCanonicalName().equals(mClass.getName())) {
            return true;
        }// ww w  .  j  a  v  a 2s .  co  m
    }
    return false;
}

From source file:Main.java

public static void startService(Context context, Class clazz, Intent intent) {
    if (!isServiceRunning(context, clazz.getName())) {
        context.startService(intent);//from  ww  w.  ja v  a  2 s.c o m
    }
}

From source file:org.dozer.functional_tests.support.ApplicationBeanFactory.java

public static Object getBean(Class<Mapper> beanClass) {
    return beanFactory.getBean(beanClass.getName());
}

From source file:springfox.documentation.spring.web.HandlerMethodReturnTypes.java

public static Optional<Class> useType(Class beanType) {
    if (Class.class.getName().equals(beanType.getName())) {
        return Optional.absent();
    }//from  w  ww .j a v  a 2 s  .c  o m
    return Optional.fromNullable(beanType);
}

From source file:Main.java

public static long NonSearchingJavaToUnoType(Object obj, boolean errorIfMissing) throws Throwable {
    Class<?> firstCls = obj.getClass();
    String clsName = firstCls.getName();
    Long unoTypePtr = unoTypes.get(clsName);
    if (unoTypePtr == null) {
        if (errorIfMissing) {
            String msg = "NonSearchingJavaToUnoType: Could not find uno type for " + clsName;
            throw new Exception(msg);
        } else {//from  w w w . jav a  2  s. c om
            return 0L;
        }
    }
    return (long) unoTypePtr;
}

From source file:Main.java

private static String getUnmappedElementName(Class<?> c, boolean brief) {
    if (brief) {//  w  ww.ja va  2 s.co m
        String name = c.getName();
        return name.substring(name.lastIndexOf('.') + 1);
    }
    return c.toString();
}

From source file:Main.java

/**
 * Register the given common classes with the ClassUtils cache.
 *//*from w  ww  .j  av  a  2s . c o m*/
private static void registerCommonClasses(Class<?>... commonClasses) {
    for (Class<?> clazz : commonClasses) {
        commonClassCache.put(clazz.getName(), clazz);
    }
}

From source file:dk.dma.epd.common.text.TextUtils.java

/**
 * Return class name without package/*from w w w  .  j  a  v a  2s. c  o  m*/
 * @param cls
 * @return
 */
public static String className(Class<?> cls) {
    String[] nameParts = StringUtils.split(cls.getName(), '.');
    return nameParts[nameParts.length - 1];
}

From source file:Main.java

public static String generateNameOfMethod(Class<?> providerClass, Method method) {
    StringBuilder buider = new StringBuilder(providerClass.getName()).append(method.getName());
    Class<?>[] paramTypes = method.getParameterTypes();
    for (Class<?> c : paramTypes) {
        buider.append(c.getName());//from   w w  w  .  jav  a2s  .  co m
    }
    return buider.toString();
}

From source file:SampleSuper.java

static void printSuperclasses(Object o) {
    Class subclass = o.getClass();
    Class superclass = subclass.getSuperclass();
    while (superclass != null) {
        String className = superclass.getName();
        System.out.println(className);
        subclass = superclass;//from   w ww  .  java 2  s  .c om
        superclass = subclass.getSuperclass();
    }
}