public class RandomObjectFactory extends Object
| Constructor and Description |
|---|
RandomObjectFactory() |
| Modifier and Type | Method and Description |
|---|---|
static <T> T |
newRandomObject(@NonNull Class<T> cls,
String... ignoreFieldNames)
Factory method for create a new random object of the given
Class. |
static Object |
newRandomValue(Field field)
Factory method for create a new random value for the given
field |
public static <T> T newRandomObject(@NonNull
@NonNull Class<T> cls,
String... ignoreFieldNames)
throws IllegalAccessException,
InstantiationException,
NoSuchFieldException
Class.T - the generic typecls - the classignoreFieldNames - an optional array with the field names that shell be ignoredIllegalAccessException - is thrown if the class or its default constructor is not accessible.InstantiationException - is thrown if this Class represents an abstract class, an interface, an
array class, a primitive type, or void; or if the class has no default
constructor; or if the instantiation fails for some other reason.NoSuchFieldException - is thrown if no such field existspublic static Object newRandomValue(Field field) throws IllegalAccessException, InstantiationException, NoSuchFieldException
fieldfield - the fieldIllegalAccessException - is thrown if the class or its default constructor is not accessible.InstantiationException - is thrown if this Class represents an abstract class, an interface, an
array class, a primitive type, or void; or if the class has no default
constructor; or if the instantiation fails for some other reason.NoSuchFieldException - is thrown if no such field existsCopyright © 2015–2019 Alpha Ro Group UG (haftungsbeschrÀngt). All rights reserved.