Factory Example 1
import org.apache.commons.collections.Factory; import org.apache.commons.collections.FactoryUtils; public class FactoryExampleV1 { public static void main(String args[]) { Factory bufferFactory = FactoryUtils.instantiateFactory(StringBuffer.class, new Class[] {String.class}, new Object[] {"a string"}); System.err.println(bufferFactory.create()); } }