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.easyjf.core.i18n.I18nInteceptor.java

public Object invoke(MethodInvocation mv) throws Throwable {
    Object returnObject = null;//from   w  w w. j  a  v a 2s.  co  m
    if (isSaveMethod(mv.getMethod())) {
        if (mv.getArguments()[0] instanceof LocaleSupport) {
            Object oldObject = mv.getArguments()[0];
            String oldClazzName = oldObject.getClass().getCanonicalName();
            Object newObj = createI18nClass(oldClazzName);
            com.easyjf.beans.BeanUtils.copyProperties(mv.getArguments()[0], newObj);
            mv.getArguments()[0] = newObj;
            returnObject = mv.proceed();
            if ("save".equals(mv.getMethod().getName()))
                com.easyjf.beans.BeanUtils.copyProperties(newObj, oldObject);
        } else {
            returnObject = mv.proceed();
        }

    } else if (isFindMethod(mv.getMethod())) {
        Class oldClazz = ((GenericDAOImpl) mv.getThis()).getClassType();
        if (LocaleSupport.class.isAssignableFrom(oldClazz)) {
            String oldClazzName = oldClazz.getCanonicalName();
            Class newObj = createI18nClass(oldClazzName).getClass();
            ((GenericDAOImpl) mv.getThis()).setClazzType(newObj);
        }
        returnObject = mv.proceed();
        ((GenericDAOImpl) mv.getThis()).setClazzType(oldClazz);
    } else
        returnObject = mv.proceed();

    return returnObject;
}

From source file:com.ryantenney.metrics.spring.MeteredMethodInterceptor.java

public MeteredMethodInterceptor(final MetricRegistry metrics, final Class<?> targetClass) {
    this.metrics = metrics;
    this.targetClass = targetClass;
    this.meters = new HashMap<MethodKey, Meter>();

    LOG.debug("Creating method interceptor for class {}", targetClass.getCanonicalName());
    LOG.debug("Scanning for @Metered annotated methods");

    ReflectionUtils.doWithMethods(targetClass, this, METHOD_FILTER);
}

From source file:com.tapas.evidence.fe.main.MainPresenter.java

public void onOpenModule(final Class<? extends BasePresenter<?, ? extends EventBus>> presenter) {
    // opening module invoked from menu 
    log.debug("Openning module for presenter {}", presenter.getCanonicalName());
    final IPresenterFactory pf = this.application.getPresenterFactory();
    this.contentPresenter = pf.createPresenter(presenter.getAnnotation(Component.class).value());
    this.view.setContent((com.vaadin.ui.Component) this.contentPresenter.getView());
}

From source file:com.metawiring.load.generator.GeneratorInstanceFactory.java

public GeneratorInstanceFactory(Class<? extends Generator> generatorClass, Object... constructorParams) {
    String conj = "";
    StringBuilder spec = new StringBuilder();
    spec.append(generatorClass.getCanonicalName()).append(":");
    for (Object o : constructorParams) {
        spec.append(conj);//from  w  ww . ja v  a 2  s.  c om
        conj = ":";
        spec.append(o.toString());
    }
    this.generatorSpec = spec.toString();
    setLocal();
}

From source file:com.ryantenney.metrics.spring.TimedMethodInterceptor.java

public TimedMethodInterceptor(final MetricRegistry metrics, final Class<?> targetClass) {
    this.metrics = metrics;
    this.targetClass = targetClass;
    this.timers = new HashMap<MethodKey, Timer>();

    LOG.debug("Creating method interceptor for class {}", targetClass.getCanonicalName());
    LOG.debug("Scanning for @Timed annotated methods");

    ReflectionUtils.doWithMethods(targetClass, this, METHOD_FILTER);
}

From source file:de.cpoepke.demos.neo4j.querydsl.UserRepositoryTest.java

/**
 * Test data helper methods//from  w w w .ja v  a 2 s. c  o m
 */

private StartExpression domainStartNodes(String name, Class clazz) {
    return lookup(name, IndexingNodeTypeRepresentationStrategy.INDEX_NAME,
            IndexingNodeTypeRepresentationStrategy.INDEX_KEY, clazz.getCanonicalName());
}

From source file:capital.scalable.restdocs.constraints.ConstraintAndGroupDescriptionResolver.java

@Override
public String resolveGroupDescription(Class group, String constraintDescription) {
    // Pretending that the group class is a constraint to use the same logic for getting
    // a description.
    Constraint groupConstraint = new Constraint(group.getCanonicalName(),
            singletonMap(VALUE, (Object) constraintDescription));
    String result = resolvePlainDescription(groupConstraint);
    return isBlank(result) ? fallbackGroupDescription(group, constraintDescription) : result;
}

From source file:io.leishvl.core.prov.Provenance.java

public Attribute classAttr(final Class<?> clazz) {
    return (Attribute) PROVENANCE.factory().newOther(PROVENANCE.qn("class"), clazz.getCanonicalName(),
            PROVENANCE.factory().getName().XSD_STRING);
}

From source file:org.rapidoid.db.impl.inmem.JacksonEntitySerializer.java

@Override
public byte[] serialize(Object entity) {
    Class<?> entityType = db.schema().getEntityTypeFor(entity.getClass());
    return stringifyWithExtras(Beany.serialize(entity), "_class", entityType.getCanonicalName());
}

From source file:capital.scalable.restdocs.javadoc.JavadocReaderImpl.java

private String classToRelativePath(Class<?> clazz) {
    String packageName = clazz.getPackage().getName();
    String packageDir = packageName.replace(".", File.separator);
    String className = clazz.getCanonicalName().replaceAll(packageName + "\\.?", "");
    return new File(packageDir, className + ".json").getPath();
}