com.twitter.common.base
Class MoreSuppliers

java.lang.Object
  extended by com.twitter.common.base.MoreSuppliers

public final class MoreSuppliers
extends Object

Utility methods for working with Suppliers.


Method Summary
static
<T> Supplier<T>
of(Class<? extends T> type)
          Creates a Supplier that uses the no-argument constructor of type to supply new instances.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

of

public static <T> Supplier<T> of(Class<? extends T> type)
Creates a Supplier that uses the no-argument constructor of type to supply new instances.

Type Parameters:
T - the type of object this supplier creates
Parameters:
type - the type of object this supplier creates
Returns:
a Supplier that created a new obeject of type T on each call to Supplier.get()
Throws:
IllegalArgumentException - if the given type does not have a no-arg constructor