List of usage examples for java.lang Class getCanonicalName
public String getCanonicalName()
From source file:de.fischer.thotti.core.configuration.ConfigDenormalizer.java
private String getFQCNFromHolderOfDTJ(ThottiAnnotationHolder<DistributedTestJob> holder) { AnnotatedElement element = holder.getOrigin(); assert element instanceof Class : "Only methods are currently supported."; Class clazz = (Class) element; assert clazz.isInterface() == false : "Annotation of interfaces is not supported."; return clazz.getCanonicalName(); }
From source file:org.parancoe.web.PopulateInitialDataContextListener.java
private void populateTableForModel(final Class model, final List fixtures) { String fixtureName = YamlFixtureHelper.getModelName(model); GenericDaoBase dao = DaoUtils.getDaoFor(model, ctx); if (dao == null) { log.info("Dao not found for {} and po {}", fixtureName, model.getCanonicalName()); return;//from ww w . j a va 2 s . com } if (dao.count() == 0) { log.info("Populating {} with {} items...", fixtureName, fixtures.size()); final HibernateTemplate template = ((GenericDaoHibernateSupport) dao).getHibernateTemplate(); try { for (Object entity : fixtures) { template.saveOrUpdate(entity); } template.flush(); template.clear(); } catch (Exception e) { log.error("Error populating rows in {} table", fixtureName, e); } log.info("Population of {} done!", fixtureName); } else { log.info("Population of {} skipped (already populated)", fixtureName); } }
From source file:com.qcadoo.view.internal.CustomMethodHolder.java
private Object getCustomMethodBean(final Class<?> clazz, final ApplicationContext applicationContext) { Object hookBean = applicationContext.getBean(clazz); if (hookBean == null) { final String msg = String.format(BEAN_NOT_FOUND_MSG, clazz.getCanonicalName()); throw new IllegalStateException(msg); }// w ww . ja v a2 s.c o m return hookBean; }
From source file:net.nan21.dnet.core.business.service.AbstractBusinessBaseService.java
/** * Return a new instance of a business delegate by the given class. * //w ww . ja va 2 s .co m * @param <T> * @param clazz * @return * @throws BusinessException */ public <T extends AbstractBusinessDelegate> T getBusinessDelegate(Class<T> clazz) throws BusinessException { T delegate; try { delegate = clazz.newInstance(); } catch (Exception e) { throw new BusinessException("Cannot create a new instance of " + clazz.getCanonicalName(), e); } delegate.setApplicationContext(this.getApplicationContext()); delegate.setEntityManager(this.getEntityManager()); return delegate; }
From source file:com.cognifide.aemrules.extensions.RulesLoader.java
@CheckForNull RulesDefinition.NewRule loadRule(RulesDefinition.NewExtendedRepository repo, Class<? extends JavaCheck> clazz) { Rule ruleAnnotation = AnnotationUtils.getAnnotation(clazz, Rule.class); if (ruleAnnotation != null) { return loadRule(repo, clazz, ruleAnnotation); } else {//from w w w . j av a 2 s . c o m LOG.warn("The class {} should be annotated with {}", clazz.getCanonicalName(), Rule.class); return null; } }
From source file:com.glaf.core.util.ReflectUtils.java
/** * Returns the field of the given class or null if it doesnt exist. *//*ww w .java 2 s. c o m*/ public static Field getField(String fieldName, Class<?> clazz) { Field field = null; try { field = clazz.getDeclaredField(fieldName); } catch (SecurityException e) { throw new RuntimeException( "not allowed to access field " + field + " on class " + clazz.getCanonicalName()); } catch (NoSuchFieldException e) { // for some reason getDeclaredFields doesnt search superclasses // (which getFields() does ... but that gives only public fields) Class<?> superClass = clazz.getSuperclass(); if (superClass != null) { return getField(fieldName, superClass); } } return field; }
From source file:com.greplin.gec.GecLogbackAppender.java
/** * Adds a class that can be considered a container of exceptions only. * * @param exceptionClass the exception class *///from w ww .j a va 2s .com public void addPassthroughExceptionClass(final Class<? extends Throwable> exceptionClass) { this.passthroughExceptions.add(exceptionClass.getCanonicalName()); }
From source file:com.vertica.hadoop.VerticaOutputFormat.java
/** (@inheritDoc) */ public OutputCommitter getOutputCommitter(TaskAttemptContext context) throws IOException, InterruptedException { VerticaConfiguration config = new VerticaConfiguration(context.getConfiguration()); try {//from w ww. j a va 2 s .c o m Class outputCommitterClass = config.getOutputCommitterClass(); LOG.info("Initializing OutputCommitter class " + outputCommitterClass.getCanonicalName()); return initializeOutputCommitter(outputCommitterClass, context.getConfiguration()); } catch (ClassNotFoundException e) { throw new IOException("Could not find OutputCommitter class confiugured as " + VerticaConfiguration.OUTPUT_COMMITTER_CLASS_PARAM, e); } }
From source file:com.mmnaseri.dragonfly.runtime.session.impl.AbstractSessionPreparator.java
private void registerExtensions(Collection<SessionInitializationEventHandler> eventHandlers) { log.info("Finding extensions to the data access ..."); final ExtensionMetadataResolver<Class<?>> metadataResolver = getExtensionMetadataResolver(); final List<Class> extensionClasses = new ArrayList<Class>(); for (LookupSource source : extensionDefinitionSources) { Collections.addAll(extensionClasses, source.getClasses(basePackages)); }/*from w w w .j a va 2 s . co m*/ for (SessionInitializationEventHandler eventHandler : eventHandlers) { eventHandler.beforeRegisteringExtensions(extensionManager, extensionClasses); } for (Class extensionDefinitionClass : extensionClasses) { log.debug("Registering extension " + extensionDefinitionClass.getCanonicalName()); final ExtensionMetadata extensionMetadata = metadataResolver.resolve(extensionDefinitionClass); for (SessionInitializationEventHandler eventHandler : eventHandlers) { eventHandler.beforeRegisteringExtension(extensionManager, extensionMetadata); } extensionManager.addExtension(extensionMetadata); for (SessionInitializationEventHandler eventHandler : eventHandlers) { eventHandler.afterRegisteringExtension(extensionManager, extensionMetadata); } } for (SessionInitializationEventHandler eventHandler : eventHandlers) { eventHandler.beforeRegisteringExtensions(extensionManager, extensionClasses); } }
From source file:com.ebay.erl.mobius.core.mapred.MultiInputsHelpersRepository.java
public MultiInputsHelpersRepository register(Class<? extends InputFormat> inputFormat, Class<? extends MultiInputsHelper> aFinder) { if (this.mapping.containsKey(inputFormat)) { MultiInputsHelper oldFinder = this.mapping.get(inputFormat); LOGGER.warn("Override the handler for [" + inputFormat.getCanonicalName() + "] from [" + oldFinder.getClass().getCanonicalName() + "]" + " to [" + aFinder.getClass().getCanonicalName() + "]."); }/*from ww w . j a va 2 s . c o m*/ this.mapping.put(inputFormat, ReflectionUtils.newInstance(aFinder, null)); return this; }