Example usage for org.apache.commons.lang3 ClassUtils PACKAGE_SEPARATOR_CHAR

List of usage examples for org.apache.commons.lang3 ClassUtils PACKAGE_SEPARATOR_CHAR

Introduction

In this page you can find the example usage for org.apache.commons.lang3 ClassUtils PACKAGE_SEPARATOR_CHAR.

Prototype

char PACKAGE_SEPARATOR_CHAR

To view the source code for org.apache.commons.lang3 ClassUtils PACKAGE_SEPARATOR_CHAR.

Click Source Link

Document

The package separator character: '.' == .

Usage

From source file:com.neocotic.blingaer.common.dao.DAOLocator.java

/**
 * Retrieves the POJO implementation of the {@link DAO} {@code class}
 * provided./*from  www  .j  a v  a 2s .  c o m*/
 * <p>
 * Reflection is used to lookup the POJO implementation and delegate calls
 * to it.
 * 
 * @param cls
 *            the {@code DAO class} whose POJO implementation is to be
 *            located
 * @return the POJO implementation of the specified {@code class}
 * @throws BlingaerRuntimeException
 *             If an error occurs while loading/instantiating the new
 *             {@code Service class}.
 */
@SuppressWarnings("unchecked")
public <T extends DAO> T getDAO(Class<T> cls) throws BlingaerRuntimeException {
    LOG.trace("Entered method - getDAO");

    String className = cls.getName() + IMPL_CLASS_SUFFIX;

    // Injects datastore package name in to
    String[] arr = StringUtils.split(className, ClassUtils.PACKAGE_SEPARATOR_CHAR);
    arr = ArrayUtils.add(arr, arr.length - 1, dataStore);
    className = StringUtils.join(arr, ClassUtils.PACKAGE_SEPARATOR_CHAR);

    DAO impl = newDAOImpl(className);

    /*
     * Currently not caching these results as I'm not sure if it will have a
     * negative affect on objectify
     */

    LOG.trace("Exiting method - getDAO");

    return (T) impl;
}