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.ebay.erl.mobius.core.builder.DatasetBuildersFactory.java

/**
 * This method is used to generate a {@link Dataset} based on a result generated by previous
 * Mobius job, so that the user can continue to refine the {@link Dataset} 
 * // w w  w .ja  v  a2  s  .  c  o  m
 * @param prevJobOutFmt the output format of previous job (an intermediate result in a flow).
 * @param datasetName the name to be used for the new dataset.
 * @return an implementation of {@link AbstractDatasetBuilder} for building a dataset from
 * the intermediate result.
 */
public AbstractDatasetBuilder getBuilder(Class<? extends FileOutputFormat> prevJobOutFmt, String datasetName) {
    Class<? extends AbstractDatasetBuilder> builderClass = _DATASET_BUILDERS.get(prevJobOutFmt);
    if (builderClass != null) {
        LOGGER.info("Using " + builderClass.getCanonicalName() + " as the dataset builder for "
                + prevJobOutFmt.getCanonicalName());

        AbstractDatasetBuilder<?> builder = null;
        try {
            builder = builderClass.getDeclaredConstructor(MobiusJob.class, String.class).newInstance(this.job,
                    datasetName);
            return builder;
        } catch (SecurityException e) {
            throw new RuntimeException(e);
        } catch (InstantiationException e) {
            throw new RuntimeException(e);
        } catch (IllegalAccessException e) {
            throw new RuntimeException(e);
        } catch (InvocationTargetException e) {
            throw new RuntimeException(e);
        } catch (NoSuchMethodException e) {
            throw new RuntimeException(builderClass.getCanonicalName()
                    + " doesn't provide a constructor which accepts one " + MobiusJob.class.getCanonicalName()
                    + " and String.class as the arguments, please provide such constructor.");
        }
    } else {
        throw new RuntimeException(
                "Cannot find a dataset builder for output format:" + prevJobOutFmt.getCanonicalName() + ", "
                        + "please use " + DatasetBuildersFactory.class.getCanonicalName()
                        + "#register to register a builder for this output format.");
    }
}

From source file:com.ebay.erl.mobius.core.builder.DatasetBuildersFactory.java

/**
 * Register a new implementation of {@link AbstractDatasetBuilder} which generates a {@link Dataset}
 * that read the data generated by the {@link OutputFormat}.
 * // w w w.  ja va2  s  . c om
 * @param outputFormat an output format type from previous job that the given <code>builder</code>
 * will be used to create a dataset.
 * @param builder an implementation of AbstractDatasetBuilder to build the dataset from an intermediate
 * result (in the format of the given <code>outputFormat</code>).
 * @return the {@link DatasetBuildersFactory} itself.
 * @throws IOException
 */
public DatasetBuildersFactory register(Class<? extends OutputFormat> outputFormat,
        Class<? extends AbstractDatasetBuilder> builder) throws IOException {
    LOGGER.info(
            "Set dataset buider for " + outputFormat.getCanonicalName() + " to " + builder.getCanonicalName());
    this._DATASET_BUILDERS.put(outputFormat, builder);
    return this;
}

From source file:com.freiheit.fuava.ctprofiler.spring.ProfilingPostProcessor.java

private boolean isCandidateIface(final Class<?> cls) {
    if (cls == null || !cls.isInterface()) {
        return false;
    }//w  ww  .  j  ava2s.  c  o m
    for (final Pattern p : getPatterns()) {
        if (p.matcher(cls.getCanonicalName()).matches()) {
            return true;
        }
    }
    return false;
}

From source file:org.gaixie.micrite.security.service.impl.MutableAclServiceImpl.java

public void addPermission(AbstractSecureObject securedObject, Sid recipient, Permission permission,
        Class clazz) {
    MutableAcl acl;/*from   w ww . j a v a 2 s  .  co m*/

    ObjectIdentity oid = new ObjectIdentityImpl(clazz.getCanonicalName(), securedObject.getId());

    try {
        acl = (MutableAcl) readAclById(oid);
    } catch (NotFoundException nfe) {
        acl = createAcl(oid);
    }

    acl.insertAce(acl.getEntries().length, permission, recipient, true);
    updateAcl(acl);
}

From source file:com.mmnaseri.dragonfly.data.impl.DefaultDataAccessSession.java

/**
 * @return the statement registry associated with session
 *///www  . j  a  v a  2  s.  c om
@Override
public StatementRegistry getStatementRegistry(Class<?> entityType) {
    return getStatementRegistry(entityType.getCanonicalName());
}

From source file:info.archinnov.achilles.entity.parsing.EmbeddedIdParser.java

public EmbeddedIdProperties parseEmbeddedId(Class<?> embeddedIdClass) {
    log.debug("Parse multikey class {} ", embeddedIdClass.getCanonicalName());

    Constructor<?> defaultConstructor = getDefaultConstructor(embeddedIdClass);

    Map<Integer, Field> components = extractComponentsOrdering(embeddedIdClass);
    Integer reversedField = extractReversedClusteredKey(embeddedIdClass);
    validateConsistentPartitionKeys(components, embeddedIdClass.getCanonicalName());
    validateReversedClusteredKey(components, reversedField, embeddedIdClass.getCanonicalName());
    EmbeddedIdProperties embeddedIdProperties = buildComponentMetas(embeddedIdClass, components, reversedField,
            defaultConstructor);//from w  ww.  j  a  va 2 s .c  o m

    log.trace("Built embeddedId properties : {}", embeddedIdProperties);
    return embeddedIdProperties;
}

From source file:eu.trentorise.smartcampus.communicatorservice.storage.CommunicatorStorage.java

public <T extends BasicObject> void deleteObjectsPermanently(Class<T> cls, String user) throws DataException {
    mongoTemplate.remove(Query.query(Criteria.where("user").is(user).and("type").is(cls.getCanonicalName())),
            getObjectClass());//  w ww .j  a  v  a  2s  .  com
}

From source file:com.netflix.explorers.ExplorersManagerImpl.java

@Override
public <T> void registerService(Class<T> serviceClass, Supplier<T> supplier) {
    if (null != services.putIfAbsent(serviceClass, supplier)) {
        throw new RuntimeException("Service for " + serviceClass.getCanonicalName() + " already registered");
    }/*from   w  w w.  j  av  a2s .c  om*/
}

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

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

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

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

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

@Override
@SuppressWarnings("unchecked")
protected <T> JAXBElement<T> createType(final T obj) {
    Object element;/*from   w ww .  j  a v a  2  s . c o m*/
    Class<?> clazz = obj.getClass();
    if (clazz.equals(ESearchResult.class)) {
        element = ESEARCH_XML_FACTORY.createESearchResult();
    } else {
        throw new IllegalArgumentException("Unsupported type: " + clazz.getCanonicalName());
    }
    return (JAXBElement<T>) element;
}