Example usage for java.lang Class getCanonicalName

List of usage examples for java.lang Class getCanonicalName

Introduction

In this page you can find the example usage for java.lang Class getCanonicalName.

Prototype

public String getCanonicalName() 

Source Link

Document

Returns the canonical name of the underlying class as defined by the Java Language Specification.

Usage

From source file:com.sqewd.open.dal.core.persistence.DataManager.java

private void scanEntities(final List<Class<?>> classes) throws Exception {
    for (Class<?> type : classes) {
        if (type.isAnnotationPresent(Entity.class)) {
            log.debug("Found entity : [" + type.getCanonicalName() + "]["
                    + type.getClassLoader().getClass().getCanonicalName() + "]");
            ReflectionUtils.get().load(type);
        }//from   w w w .  ja v a 2s .co  m
    }
}

From source file:egovframework.rte.fdl.cmmn.aspect.ExceptionTransfer.java

/**
 * ? Exception ? ?  ??   ??  ? ./*from  www .ja  va 2s .  com*/
 * 
 * @param clazz Exception ? ? 
 * @param methodName Exception ?  
 * @param exception ? Exception 
 * @param pm ? PathMatcher(default : AntPathMatcher) 
 * @param exceptionHandlerServices[] ??  ExceptionHandlerService 
 */
protected void processHandling(Class clazz, String methodName, Exception exception, PathMatcher pm,
        ExceptionHandlerService[] exceptionHandlerServices) {
    try {
        for (ExceptionHandlerService ehm : exceptionHandlerServices) {

            if (!ehm.hasReqExpMatcher())
                ehm.setReqExpMatcher(pm);
            ehm.setPackageName(clazz.getCanonicalName() + "." + methodName);
            ehm.run(exception);

        }
    } catch (Exception e) {
    }
}

From source file:io.leishvl.core.xml.GbSeqXmlBinder.java

@Override
@SuppressWarnings("unchecked")
protected <T> JAXBElement<T> createType(final T obj) {
    Object element;//from   www.  j ava2s.c o m
    Class<?> clazz = obj.getClass();
    if (clazz.equals(GBSet.class)) {
        element = GBSEQ_XML_FACTORY.createGBSet();
    } else if (clazz.equals(GBSeq.class)) {
        element = GBSEQ_XML_FACTORY.createGBSeq();
    } else {
        throw new IllegalArgumentException("Unsupported type: " + clazz.getCanonicalName());
    }
    return (JAXBElement<T>) element;
}

From source file:com.meltmedia.cadmium.core.config.impl.YamlConfigurationParser.java

/**
 * //  w  w  w  .j a  v  a 2 s  .  co  m
 * @return A new Representer Instance with the tags specified by the {@link configurationClasses} list.
 */
private Constructor getClassTags() {
    Constructor constructor = new YamlLenientConstructor();
    if (configurationClasses != null) {
        for (Class<?> configClass : configurationClasses) {
            CadmiumConfig configAnnotation = configClass.getAnnotation(CadmiumConfig.class);
            if (configAnnotation != null) {
                String key = configAnnotation.value();
                if (StringUtils.isEmptyOrNull(key)) {
                    key = configClass.getCanonicalName();
                }

                if (key != null) {
                    constructor.addTypeDescription(new TypeDescription(configClass, "!" + key));
                    logger.trace("Adding configuration tag {} for class {}", "!" + key, configClass);
                }
            }
        }
    }
    return constructor;
}

From source file:com.tongbanjie.tarzan.rpc.protocol.RpcCommand.java

private String getCanonicalName(Class clazz) {
    String name = canonicalNameCache.get(clazz);

    if (name == null) {
        name = clazz.getCanonicalName();
        synchronized (canonicalNameCache) {
            canonicalNameCache.put(clazz, name);
        }//from   ww w .j  ava2  s. c o m
    }
    return name;
}

From source file:com.grizzly.rest.WebServiceFactory.java

public <T extends sendRestData, X> EasyRestCall<T, X> getRestCallInstance(Class<T> entityClass,
        Class<X> responseClass, boolean isTest) {

    EasyRestCall<T, X> myRestCall = null;

    if (isTest) {
        myRestCall = new EasyRestCall<>(entityClass, responseClass, 1);
    } else {//w w w  .  j a v a 2 s.co  m
        myRestCall = new EasyRestCall<>(entityClass, responseClass);
    }

    try {
        if (context != null) {
            myRestCall.setContext(getContext());

            if (!responseClass.getCanonicalName().equalsIgnoreCase(Void.class.getCanonicalName())) {

                String uuid = UUID.randomUUID().toString();
                if (cachedRequests.containsKey(myRestCall.getUrl())) {
                    uuid = cachedRequests.get(myRestCall.getUrl());
                }
                myRestCall.setCachedFileName(uuid);
                cachedRequests.put(myRestCall.getUrl(), uuid);
            }
        }
    } catch (NullPointerException e) {
        e.printStackTrace();
    }

    return myRestCall;
}

From source file:com.xeiam.xchange.ExchangeSpecification.java

/**
 * Static binding//  ww w . jav a  2s  .c o m
 * 
 * @param exchangeClass The exchange class
 */
public ExchangeSpecification(Class exchangeClass) {

    this.exchangeClassName = exchangeClass.getCanonicalName();
}

From source file:org.smf4j.spring.RegistryNodeTemplateDefinitionParser.java

protected BeanDefinitionBuilder getBdb(Class<?> clazz) {
    return getBdb(clazz.getCanonicalName());
}

From source file:me.st28.flexseries.flexcore.plugin.FlexPlugin.java

/**
 * @return a module registered for this plugin.
 * @throws java.lang.IllegalArgumentException Thrown if the module is not registered under this plugin.
 *//*from ww w.  j  a  v  a2  s .c  om*/
public final <T extends FlexModule> T getModule(Class<T> clazz) {
    if (!modules.containsKey(clazz)) {
        throw new IllegalArgumentException("Module with class '" + clazz.getCanonicalName()
                + "' is not registered underneath this plugin.");
    }
    return (T) modules.get(clazz);
}

From source file:com.impetus.kundera.index.LuceneIndexer.java

@Override
public boolean entityExistsInIndex(Class<?> entityClass) {
    String luceneQuery = "+" + ENTITY_CLASS_FIELD + ":" + entityClass.getCanonicalName().toLowerCase();
    Map<String, String> results;
    try {/*w  ww .  j a v  a  2 s  . com*/
        results = search(luceneQuery, 0, 10, false);
    } catch (LuceneIndexingException e) {
        return false;
    }
    if (results == null || results.isEmpty()) {
        return false;
    } else {
        return true;
    }
}