|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.google.common.testing.ArbitraryInstances
@Beta public final class ArbitraryInstances
Supplies an arbitrary "default" instance for a wide range of types, often useful in testing utilities.
Covers common types defined in java.lang, java.lang.reflect, java.io,
java.nio, java.math, java.util, java.util.concurrent,
java.util.regex, com.google.common.base, com.google.common.collect
and com.google.common.primitives. In addition, any public class that exposes a public
parameter-less constructor will be "new"d and returned.
All default instances returned by get(java.lang.Class are generics-safe. Clients won't get type
errors for using get(Comparator.class) as a Comparator<Foo>, for example.
Immutable empty instances are returned for collection types; "" for string;
0 for number types; reasonable default instance for other stateless types. For mutable
types, a fresh instance is created each time get() is called.
| Method Summary | ||
|---|---|---|
static
|
get(Class<T> type)
Returns an arbitrary value for type as the null value, or null if empty-ness is
unknown for the type. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
@Nullable public static <T> T get(Class<T> type)
type as the null value, or null if empty-ness is
unknown for the type.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||