List of usage examples for org.apache.commons.beanutils ConstructorUtils invokeExactConstructor
public static Object invokeExactConstructor(Class klass, Object[] args, Class[] parameterTypes) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException
Returns new instance of klazz created using constructor with signature parameterTypes and actual arguments args.
The signatures should match exactly.
From source file:org.molasdin.wbase.batis.spring.repository.BatisRepositoryFactoryBean.java
@SuppressWarnings("unchecked") @Override//from ww w . ja v a2s. c om public F getObject() throws Exception { SpringBatisSupport<M> support = new SpringBatisSupport<M>(mapperClass); support.setTemplate(template); support.setTransactionManager(txManager); BatisRepository<T, M, ?> repo = ConstructorUtils.invokeExactConstructor(repositoryClass, new Object[] { support }, new Class[] { BatisSupport.class }); Class<T> mappedClass = BatisUtil.mappedClass(mapperClass); if (StringUtils.isBlank(mapperId)) { repo.setMapperId(mappedClass.getCanonicalName()); } else { repo.setMapperId(mapperId); } return (F) repo; }