![JAR search and dependency download from the Maven repository](/logo.png)
org.supercsv.ext.builder.SpringCellProcessorBuilderFacatory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of super-csv-annotation Show documentation
Show all versions of super-csv-annotation Show documentation
CSVのJavaライブラリであるSuperCSVに、アノテーション機能を追加したライブラリです。
package org.supercsv.ext.builder;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.util.Assert;
/**
* Springのコンテナで管理している{@link CellProcessorBuilder}を取得するクラス。
* 利用するには、このクラスをSpringのコンテナに登録しておく必要があります。
*
* @since 1.1
* @author T.TSUCHIE
*
*/
public class SpringCellProcessorBuilderFacatory
implements CellProcessorBuilderFactory, ApplicationContextAware, InitializingBean {
private AutowireCapableBeanFactory beanFactory;
private ApplicationContext applicationContext;
@Override
public > T create(final Class builderClass) throws Exception {
Assert.notNull(builderClass, "builderClass must not be null");
return this.beanFactory.createBean(builderClass);
}
@Override
public void afterPropertiesSet() throws Exception {
if(applicationContext != null && beanFactory == null) {
this.beanFactory = applicationContext.getAutowireCapableBeanFactory();
}
}
@Override
public void setApplicationContext(final ApplicationContext applicationContext) throws BeansException {
this.applicationContext = applicationContext;
}
public AutowireCapableBeanFactory getBeanFactory() {
return beanFactory;
}
public void setBeanFactory(AutowireCapableBeanFactory beanFactory) {
this.beanFactory = beanFactory;
}
public ApplicationContext getApplicationContext() {
return applicationContext;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy