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.chortitzer.industria.web.dao.fps.DaoImpl_fps.java

@SuppressWarnings("unchecked")
public <T> List<T> getAll(Class<T> klass) {
    return em.createQuery("Select t from " + klass.getSimpleName() + " t").getResultList();
}

From source file:org.beeInvestment.repository.jpa.JpaRepositoryImpl.java

public JpaRepositoryImpl(Class<T> type) {
    this.jpql = "SELECT DISTINCT item FROM " + type.getSimpleName() + " item";
}

From source file:org.syncope.core.persistence.dao.impl.DerAttrDAOImpl.java

@Override
public <T extends AbstractDerAttr> List<T> findAll(final Class<T> reference) {

    Query query = entityManager.createQuery("SELECT e FROM " + reference.getSimpleName() + " e");
    return query.getResultList();
}

From source file:org.syncope.core.persistence.dao.impl.VirAttrDAOImpl.java

@Override
public <T extends AbstractVirAttr> List<T> findAll(final Class<T> reference) {

    Query query = entityManager.createQuery("SELECT e FROM " + reference.getSimpleName() + " e");
    return query.getResultList();
}

From source file:seava.j4e.business.service.ServiceLocatorBusinessJee.java

/**
 * Find an entity service given the entity class.
 * //from w w w . ja  va  2  s.  co m
 * @param <E>
 * @param entityClass
 * @return
 * @throws BusinessException
 */
@Override
@SuppressWarnings("unchecked")
public <E> IEntityService<E> findEntityService(Class<E> entityClass) throws BusinessException {
    String serviceAlias = entityClass.getSimpleName();
    if (logger.isDebugEnabled()) {
        logger.debug("Looking for entity-service `" + serviceAlias + "`");
    }

    IEntityService<E> srv = (IEntityService<E>) this.applicationContext.getBean(serviceAlias);
    if (srv == null && this.applicationContext.getParent() != null) {
        srv = (IEntityService<E>) this.applicationContext.getParent().getBean(serviceAlias);
    }

    if (srv == null) {
        throw new BusinessException(ErrorCode.G_RUNTIME_ERROR,
                "Entity service `" + serviceAlias + "` not found");
    }
    return srv;
}

From source file:eu.europeana.corelib.edm.utils.EdmUtils.java

private static String getSetterMethodName(Class<?> clazz, boolean list) {
    StringBuilder sb = new StringBuilder("set");
    String clazzName = clazz.getSimpleName();
    if (StringUtils.equals("Rights", clazzName) && list) {
        clazzName = "Right";
    }/*w  w  w.j ava 2 s.  c o  m*/
    if (StringUtils.equals("SameAs", clazzName) && list) {
        clazzName = "SameA";
    }
    if (StringUtils.equals("Aggregates", clazzName) && list) {
        clazzName = "Aggregate";
    }
    if (StringUtils.equals("Incorporates", clazzName) && list) {
        clazzName = "Incorporate";
    }
    clazzName = StringUtils.strip(clazzName, "_1");
    clazzName = StringUtils.strip(clazzName, "1");

    sb.append(clazzName);
    if (list) {
        sb.append("List");
    }
    return sb.toString();
}

From source file:edu.harvard.i2b2.fhir.FhirUtil.java

public static Class getResourceClass(String resourceName) {
    for (Class c : getResourceClassList()) {
        if (c.getSimpleName().toLowerCase().equals(resourceName.toLowerCase()))
            return c;
    }/*w  ww . ja v  a 2  s. co  m*/
    // logger.trace("Class Not Found for FHIR resource:" + resourceName);
    return null;

}

From source file:integration.MongoDbSeedRule.java

private URL getClassSpecificResource(Class klazz, String name) {
    return klazz.getResource(klazz.getSimpleName() + "/" + name);
}

From source file:org.munie.envwater.dao.BaseDaoImpl.java

public List getAll(Class clazz) {
    Session session = factory.getCurrentSession();
    return session.createQuery("FROM " + clazz.getSimpleName()).list();
}

From source file:ch.puzzle.itc.mobiliar.builders.BaseEntityBuilder.java

protected String getName(String name, Class<?> clas, int id) {
    if (!StringUtils.isEmpty(name)) {
        return name;
    }//from   ww w.  j  a  v  a 2s. co  m
    return clas.getSimpleName() + id;
}