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:Utilities.java

/**
 * Returns the short name (excluding the package name) of the specified class. 
 *//*from  www  . ja v  a 2  s. c o m*/

public static String getClassName(Class c) {
    return getClassName(c.getName());
}

From source file:Main.java

/**
 * Function to check if a Service is running.
 *
 * @param serviceClass The service's class.
 * @return true if running, else false.//from www.j a  va2  s.c o m
 */
private static boolean serviceIsRunning(Class<?> serviceClass, Activity activity) {
    ActivityManager manager = (ActivityManager) activity.getSystemService(Context.ACTIVITY_SERVICE);

    for (ActivityManager.RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) {
        if (serviceClass.getName().equals(service.service.getClassName())) {
            return true;
        }
    }
    return false;
}

From source file:net.sf.dynamicreports.report.builder.datatype.DataTypes.java

public static <U, T extends DRIDataType<? super U, U>> T detectType(Class<U> dataType) throws DRException {
    return detectType(dataType.getName());
}

From source file:com.ephesoft.dcma.core.hibernate.EphesoftCriteria.java

/**
 * Creating alias for class./* w  w  w.  j av  a  2  s  .  co  m*/
 * 
 * @param clazz Class<?> 
 * @param alias String
 * @return EphesoftCriteria
 */
public static EphesoftCriteria forClass(Class<?> clazz, String alias) {
    return new EphesoftCriteria(clazz.getName(), alias);
}

From source file:io.github.moosbusch.lumpi.gui.form.spi.AbstractSubmitableForm.java

public static String createFormFieldName(Class<?> beanClass, String propertyName) {
    return createFormFieldName(beanClass.getName(), propertyName);
}

From source file:Utilities.java

/**
 * Returns the name of the package of the specified class.
 *//*from   w ww  .  jav  a  2 s .  c o m*/

public static String getPackageName(Class c) {
    return getPackageName(c.getName());
}

From source file:Main.java

public static String canonicalName(Class clazz) {
    StringBuilder name = new StringBuilder();

    if (clazz.isArray()) {
        name.append(canonicalName(clazz.getComponentType()));
        name.append("[]");
    } else if (clazz.getDeclaringClass() == null) {
        name.append(clazz.getName());
    } else {//www  .  j  a v a  2s.  co m
        name.append(canonicalName(clazz.getDeclaringClass()));
        name.append(".");
        name.append(clazz.getName().substring(clazz.getDeclaringClass().getName().length() + 1));
    }

    return name.toString();
}

From source file:com.asakusafw.testdriver.tools.runner.BatchTestTruncator.java

private static void resolveFlow(Conf conf, Class<? extends FlowDescription> aClass) {
    LOG.debug("analyzing jobflow: {}", aClass.getName()); //$NON-NLS-1$
    Constructor<?>[] ctors = aClass.getConstructors();
    if (FlowDescription.isJobFlow(aClass) == false || ctors.length != 1) {
        throw new IllegalArgumentException(
                MessageFormat.format(Messages.getString("BatchTestTruncator.errorInvalidJobflowClass"), //$NON-NLS-1$
                        aClass.getName()));
    }//from   w  w w.j a  v  a  2  s. c  o m
    for (Annotation[] as : ctors[0].getParameterAnnotations()) {
        for (Annotation a : as) {
            if (a.annotationType() == Import.class) {
                resolveImporter(conf, ((Import) a).description());
            } else if (a.annotationType() == Export.class) {
                resolveExporter(conf, ((Export) a).description());
            }
        }
    }
}

From source file:gaffer.example.gettingstarted.walkthrough.WalkthroughStrSubstitutor.java

private static String getGitHubCodeLink(final Class<?> clazz, final String modulePath) {
    return getGitHubCodeLink(clazz.getName(), modulePath);
}

From source file:py.una.pol.karaku.util.ELHelper.java

private static Field getFieldForce(String name, Class<?> clazz) {

    if (clazz.getName().toUpperCase().contains("CGLIB")) {
        return getFieldFromCGEnhancedClass(name, clazz);
    }/*from  w w  w  . j  a  v a2 s.  co  m*/
    // TODO ver cuando se utiliza javassist
    return null;
}