本文整理汇总了Java中org.apache.commons.lang3.ClassUtils.convertClassNamesToClasses方法的典型用法代码示例。如果您正苦于以下问题:Java ClassUtils.convertClassNamesToClasses方法的具体用法?Java ClassUtils.convertClassNamesToClasses怎么用?Java ClassUtils.convertClassNamesToClasses使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.lang3.ClassUtils
的用法示例。
在下文中一共展示了ClassUtils.convertClassNamesToClasses方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildInitializer
import org.apache.commons.lang3.ClassUtils; //导入方法依赖的package包/类
protected T buildInitializer(Supplier<T> defaultSupplier, Object ... args) {
List<String> initClassNames = SpringFactoriesLoader.loadFactoryNames(initClass, Thread.currentThread().getContextClassLoader());
if (initClassNames.isEmpty()) {
return defaultSupplier.get();
}
List<Class<?>> initClasses = ClassUtils.convertClassNamesToClasses(initClassNames);
initClasses.sort(AnnotationAwareOrderComparator.INSTANCE);
Class<?> primaryInitClass = initClasses.get(0);
try {
return this.initClass.cast(ConstructorUtils.invokeConstructor(primaryInitClass, args));
} catch (IllegalAccessException | InstantiationException | InvocationTargetException | NoSuchMethodException e) {
throw new ApplicationContextException(String.format("Unable to instantiate application initializer (class=%s).", primaryInitClass.getName()), e);
}
}
示例2: init
import org.apache.commons.lang3.ClassUtils; //导入方法依赖的package包/类
@Override
public void init() {
SdcctBeanDefinitionParser beanDefParser;
for (Class<?> beanDefClass : ClassUtils
.convertClassNamesToClasses(SpringFactoriesLoader.loadFactoryNames(SdcctBeanDefinitionParser.class, this.getClass().getClassLoader()))) {
try {
beanDefParser = ((SdcctBeanDefinitionParser) ConstructorUtils.invokeConstructor(beanDefClass, this));
} catch (IllegalAccessException | InstantiationException | InvocationTargetException | NoSuchMethodException e) {
throw new ApplicationContextException(String.format("Unable to instantiate bean definition parser (class=%s).", beanDefClass.getName()), e);
}
for (String beanDefParserElemLocalName : beanDefParser.getElementBeanClasses().keySet()) {
this.beanDefParsers.put(beanDefParserElemLocalName, beanDefParser);
this.registerBeanDefinitionParser(beanDefParserElemLocalName, beanDefParser);
}
}
}
示例3: buildComponent
import org.apache.commons.lang3.ClassUtils; //导入方法依赖的package包/类
protected static <T> T buildComponent(Class<T> componentClass, Supplier<T> defaultSupplier, Object ... args) {
List<String> componentClassNames = SpringFactoriesLoader.loadFactoryNames(componentClass, AbstractCrigttApplicationRunListener.class.getClassLoader());
if (componentClassNames.isEmpty()) {
return defaultSupplier.get();
}
List<Class<?>> componentClasses = ClassUtils.convertClassNamesToClasses(componentClassNames);
componentClasses.sort(AnnotationAwareOrderComparator.INSTANCE);
Class<?> primaryComponentClass = componentClasses.get(0);
try {
return componentClass.cast(ConstructorUtils.invokeConstructor(primaryComponentClass, args));
} catch (IllegalAccessException | InstantiationException | InvocationTargetException | NoSuchMethodException e) {
throw new ApplicationContextException(String.format("Unable to instantiate component (class=%s).", primaryComponentClass.getName()), e);
}
}