Example usage for org.apache.commons.lang ClassUtils getShortClassName

List of usage examples for org.apache.commons.lang ClassUtils getShortClassName

Introduction

In this page you can find the example usage for org.apache.commons.lang ClassUtils getShortClassName.

Prototype

public static String getShortClassName(String className) 

Source Link

Document

Gets the class name minus the package name from a String.

The string passed in is assumed to be a class name - it is not checked.

Usage

From source file:org.vbossica.springbox.cliapp.AbstractSpringModule.java

/**
 * Returns the name of the Spring application context to load. By default, the name is the lowercased name of the
 * module class, with the words separated by an underscore.<p>
 *
 * <b>Example</b>// ww w.  j  a v  a2s. co  m
 *
 * <ul>
 *   <li>{@code SampleModule.class} =&gt; {@code META-INF/sample_module.xml}</li>
 * </ul>
 * @return filename of the application context
 */
protected String getApplicationContextFilename() {
    String filename = StringUtils
            .join(StringUtils.splitByCharacterTypeCamelCase(ClassUtils.getShortClassName(getClass())), '_')
            .toLowerCase();
    return "META-INF/" + filename + ".xml";
}

From source file:stc.app.bean.lang.ToStringStyle.java

/**
 * <p>/*from  w  w w. j a v  a  2  s  .c o  m*/
 * Gets the short class name for a class.
 * </p>
 * 
 * <p>
 * The short class name is the classname excluding the package name.
 * </p>
 * 
 * @param cls the <code>Class</code> to get the short name of
 * @return the short name
 */
protected String getShortClassName(Class cls) {
    return ClassUtils.getShortClassName(cls);
}