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.evolveum.midpoint.repo.sql.util.ClassMapper.java

public static String getHQLType(Class<? extends ObjectType> clazz) {
    Class<? extends RObject> hqlType = getHQLTypeClass(clazz);
    return hqlType.getSimpleName();
}

From source file:cherry.foundation.type.EnumCodeUtil.java

public static <C, E extends Code<C>> Map<C, E> getMap(Class<E> type) {
    checkArgument(type.getEnumConstants() != null, "%s does not represent an enum type.", type.getSimpleName());
    Map<C, E> map = new LinkedHashMap<>();
    for (E e : type.getEnumConstants()) {
        map.put(e.code(), e);/*from   w ww. j  a  v  a  2s  .  com*/
    }
    return map;
}

From source file:cherry.foundation.type.EnumCodeUtil.java

public static <C, E extends Code<C>> List<LabeledCode<C, E>> getLabeledCodeList(Class<E> type) {
    checkArgument(type.getEnumConstants() != null, "%s does not represent an enum type.", type.getSimpleName());
    List<LabeledCode<C, E>> list = new ArrayList<>();
    for (E e : type.getEnumConstants()) {
        list.add(getLabeledCode(e));//from ww  w  . ja  v  a  2s .c o m
    }
    return list;
}

From source file:com.xemantic.tadedon.guice.lifecycle.jsr250.Jsr250Utils.java

private static String handleException(Class<? extends Annotation> jsr250Annotation, Method method,
        Exception e) {/*from  ww  w .ja  va 2  s .com*/
    throw new RuntimeException(
            "Error while invoking @" + jsr250Annotation.getSimpleName() + " method: " + method, e);
}

From source file:es.logongas.ix3.web.controllers.endpoint.EndPoint.java

public static EndPoint createEndPointCrud(String prefixPath, Class entityClass) {
    return new EndPoint(prefixPath + "/" + entityClass.getSimpleName() + "/**", null, null);
}

From source file:co.runrightfast.vertx.core.eventbus.EventBusAddress.java

/**
 *
 * @param verticleId RunRightFastVerticleId
 * @param messageClass uses the class's simple name
 * @return eventbus address//from  w w w.ja va  2s. c  o m
 */
public static String eventBusAddress(@NonNull final RunRightFastVerticleId verticleId,
        @NonNull final Class<? extends Message> messageClass) {
    return eventBusAddress(verticleId, messageClass.getSimpleName());
}

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

public static String packagePath(Class<?> codeLocationClass) {
    String classPath = codeLocationClass.getName().replace(".", "/");
    return removeEnd(classPath, codeLocationClass.getSimpleName());
}

From source file:com.xinlv.test.PortalTestUtil.java

public static String[] getMessage(String key, Class<?> clazz) {
    Properties prop = new Properties();
    try {/*from www. ja v a 2  s . co m*/
        prop.load(clazz.getResourceAsStream(clazz.getSimpleName() + ".properties"));
    } catch (IOException e) {
        // do nothing
    }
    return new String[] { prop.getProperty(key) };
}

From source file:name.martingeisse.api.i18n.ClassHierarchyLocalizationContext.java

/**
 * Loads the .properties file for the origin class and the specified locale and returns
 * either its contents as a map, or an empty map if the file cannot be found.
 * /* www .ja v a 2 s. co  m*/
 * This method is static to emphasize that it does not use or affect the calling instance
 * in any other way.
 * 
 * @param origin the origin class
 * @param locale the locale
 * @return the properties
 */
private static Map<String, String> loadProperties(Class<?> origin, Locale locale) {
    String filename = origin.getSimpleName() + '_' + locale + ".properties";
    try (InputStream inputStream = origin.getResourceAsStream(filename)) {
        if (inputStream == null) {
            @SuppressWarnings("unchecked")
            Map<String, String> emptyMap = MapUtils.EMPTY_MAP;
            return emptyMap;
        }
        Properties properties = new Properties();
        properties.load(inputStream);
        @SuppressWarnings("unchecked")
        Map<String, String> typedProperties = (Map<String, String>) (Map<?, ?>) properties;
        return typedProperties;
    } catch (IOException e) {
        logger.error("could not load i18n property file", e);
        return null;
    }
}

From source file:org.zht.framework.zhtdao.hibernate.HibernateConfigurationUtil.java

private static <T> PersistentClass getPersistentClass(Class<T> clazz) {
    synchronized (HibernateConfigurationUtil.class) {
        PersistentClass pc = getConfiguration().getClassMapping(clazz.getSimpleName());
        if (pc == null) {
            configuration = configuration.addClass(clazz);
            pc = configuration.getClassMapping(clazz.getName());
        }//from  w  w  w . ja  v a2s  .c om
        return pc;
    }
}