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:com.jdom.junit.utils.TestUtil.java

/**
 * Setup the directory the test class should use.
 * //from  w w w  .  jav  a2  s .  c o m
 * @param testClass
 *            The test class to create a directory for
 * @return The directory created for the test class
 */
public static File setupTestClassDir(Class<?> testClass) {
    File dir = new File(System.getProperty("java.io.tmpdir"), testClass.getSimpleName());

    // Delete any preexisting version
    try {
        FileUtils.deleteDirectory(dir);
    } catch (IOException e) {
        throw new IllegalStateException(e);
    }

    // Make the directory
    dir.mkdirs();

    return dir;
}

From source file:de.vandermeer.skb.interfaces.categories.has.HasToLog.java

/**
 * Returns a builder using containment class, default contained class, and values.
 * @param container the contain object class
 * @param values values, printed comma separated
 * @return an `StrBuilder` combining the inputs
 *//*from  ww w. j a va 2s  .c  om*/
static StrBuilder toLog(Class<?> container, Object... values) {
    StrBuilder ret = new StrBuilder(50).append(container.getSimpleName()).append('(').append("DefaultImpl")
            .append(')').append(": ").appendWithSeparators(values, ", ");
    ;
    return ret;
}

From source file:com.shelfmap.stepsfinder.CandidateStepsFactory.java

public static URL codeLocationFromParentPackage(Class<?> codeLocationClass) {
    String simpleName = codeLocationClass.getSimpleName() + ".class";
    String pathOfClass = codeLocationClass.getName().replace(".", "/") + ".class";
    URL classResource = codeLocationClass.getClassLoader().getResource(pathOfClass);
    String codeLocationPath = removeEnd(classResource.getFile(), simpleName);
    return codeLocationFromPath(codeLocationPath);
}

From source file:com.carmatech.maven.utils.MergeUtils.java

public static <T> String generateComment(final Class<T> clazz) {
    return "File merged by properties-files-maven-plugin, using " + clazz.getSimpleName() + ", at:";
}

From source file:edu.northwestern.bioinformatics.studycalendar.domain.tools.hibernate.HibernateTypeUtils.java

/**
 * Provide a log category for the given class that is similar to that used by hibernate for
 * its own type classes.  This makes it easier to filter the log entries to show all type
 * bindings together.//from   w w w.  j ava  2  s. co  m
 * @param clazz the type class
 * @return a log category starting with org.hibernate.type
 */
public static String getLogCategory(Class clazz) {
    return new StringBuffer("org.hibernate.type.studycalendar.").append(clazz.getSimpleName()).toString();
}

From source file:Main.java

public static void printDetails(FileStore fs, Class<? extends FileAttributeView> attribClass) {
    boolean supported = fs.supportsFileAttributeView(attribClass);
    System.out.format("%s is  supported: %s%n", attribClass.getSimpleName(), supported);
}

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

public static String controllerNameAsGroup(HandlerMethod handlerMethod) {
    Class<?> controllerClass = handlerMethod.getBeanType();
    return splitCamelCase(controllerClass.getSimpleName(), "-").replace("/", "").toLowerCase();
}

From source file:ch.citux.td.util.Log.java

public static void e(Class caller, Exception exception) {
    String tag = caller.getSimpleName();
    if (exception != null && !StringUtils.isBlank(exception.getMessage())) {
        if (BuildConfig.DEBUG) {
            exception.printStackTrace();
        } else {//  w  w  w  .  j  a v  a 2 s  .  co m
            android.util.Log.e(tag, exception.getMessage());
        }
    }
}

From source file:de.ingrid.interfaces.csw.admin.validation.AbstractValidator.java

public static final String getErrorKey(final Class<?> clazz, final String field, final String error) {
    return clazz.getSimpleName() + "." + field + "." + error;
}

From source file:gobblin.compaction.CliOptions.java

/**
 * Prints the usage of cli./*from   w  w w  .  ja v a2 s. c  o m*/
 * @param caller Class of the main method called. Used in printing the usage message.
 */
public static void printUsage(Class<?> caller) {
    new HelpFormatter().printHelp(caller.getSimpleName(), options());
}