本文整理匯總了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);
}
}