List of usage examples for java.lang.reflect Constructor newInstance
@CallerSensitive @ForceInline public T newInstance(Object... initargs) throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException
From source file:com.greenpepper.maven.plugin.Repository.java
/** * <p>newInstance.</p>//from w w w .j av a 2s . c om * * @return a {@link com.greenpepper.repository.DocumentRepository} object. * @throws java.lang.Exception if any. */ public DocumentRepository newInstance() throws Exception { Class<?> klass = Class.forName(type); if (!DocumentRepository.class.isAssignableFrom(klass)) throw new IllegalArgumentException("Not a " + DocumentRepository.class.getName() + ": " + type); Constructor<?> constructor = klass.getConstructor(String[].class); return (DocumentRepository) constructor.newInstance(new Object[] { StringUtils.split(root, ';') }); }