Example usage for org.apache.commons.collections4 FactoryUtils instantiateFactory

List of usage examples for org.apache.commons.collections4 FactoryUtils instantiateFactory

Introduction

In this page you can find the example usage for org.apache.commons.collections4 FactoryUtils instantiateFactory.

Prototype

public static <T> Factory<T> instantiateFactory(final Class<T> classToInstantiate, final Class<?>[] paramTypes,
        final Object[] args) 

Source Link

Document

Creates a Factory that can create objects of a specific type using the arguments specified to this method.

Usage

From source file:ru.anr.base.BaseParent.java

/**
 * Instantiation of object// w w  w . j av  a2 s . c  o  m
 * 
 * @param clazz
 *            Class to instantiate
 * @param paramTypes
 *            Constructor arguments
 * @param args
 *            Any arguments provided
 * @return An object
 * 
 * @param <S>
 *            Object class
 */
public static <S> S inst(Class<? extends S> clazz, Class<?>[] paramTypes, Object... args) {

    return FactoryUtils.instantiateFactory(clazz, paramTypes, args).create();
}