Example usage for org.apache.commons.beanutils ConstructorUtils invokeExactConstructor

List of usage examples for org.apache.commons.beanutils ConstructorUtils invokeExactConstructor

Introduction

In this page you can find the example usage for org.apache.commons.beanutils ConstructorUtils invokeExactConstructor.

Prototype

public static Object invokeExactConstructor(Class klass, Object[] args, Class[] parameterTypes)
        throws NoSuchMethodException, IllegalAccessException, InvocationTargetException,
        InstantiationException 

Source Link

Document

Returns new instance of klazz created using constructor with signature parameterTypes and actual arguments args.

The signatures should match exactly.

Usage

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;
}