public class ReflectionBuilder<T> extends Object implements org.apache.commons.lang3.builder.Builder
| Modifier and Type | Field and Description |
|---|---|
protected static Map<Class,Integer> |
enumCounters
Static enum counter.
|
protected static int |
propertyCount
Static counter that increments each time a property value is generated.
|
| Modifier and Type | Method and Description |
|---|---|
static <T> ReflectionBuilder<T> |
aGenerated(Class<T> entityClass)
Static constructor that creates a fully valid entity.
|
ReflectionBuilder<T> |
belongingTo(org.apache.commons.lang3.builder.Builder builder) |
ReflectionBuilder<T> |
belongingTo(Object parameter) |
T |
build() |
Object |
generateRandomValue(Class<?> type)
Generate a random value for the specified class type.
|
ReflectionBuilder<T> |
in(org.apache.commons.lang3.builder.Builder builder) |
ReflectionBuilder<T> |
in(Object parameter) |
ReflectionBuilder<T> |
ofType(Enum enumType) |
static void |
resetCounter()
Reset incrementing of the property count to 1.
|
Object |
setFieldsWithRandomValuesFor(Object instance)
Set all the fields in the instance with a random value.
|
ReflectionBuilder<T> |
with(org.apache.commons.lang3.builder.Builder builder)
Sets a property from the built entity.
|
ReflectionBuilder<T> |
with(Object parameter)
Sets a property from the passed in entity.
|
ReflectionBuilder<T> |
with(String fieldName,
org.apache.commons.lang3.builder.Builder builder) |
ReflectionBuilder<T> |
with(String fieldName,
Object value)
Sets a property using the specified field name and value.
|
protected static int propertyCount
protected static Map<Class,Integer> enumCounters
public static <T> ReflectionBuilder<T> aGenerated(Class<T> entityClass)
entityClass - Class for the entity to createpublic static void resetCounter()
public ReflectionBuilder<T> in(org.apache.commons.lang3.builder.Builder builder)
public ReflectionBuilder<T> in(Object parameter)
with(Object)public ReflectionBuilder<T> belongingTo(org.apache.commons.lang3.builder.Builder builder)
public ReflectionBuilder<T> belongingTo(Object parameter)
with(Object)public ReflectionBuilder<T> ofType(Enum enumType)
with(Object)public ReflectionBuilder<T> with(String fieldName, org.apache.commons.lang3.builder.Builder builder) throws NoSuchFieldException
NoSuchFieldExceptionwith(String, Object)public ReflectionBuilder<T> with(String fieldName, Object value) throws NoSuchFieldException
fieldName - field to set value forvalue - value to useNoSuchFieldExceptionpublic ReflectionBuilder<T> with(org.apache.commons.lang3.builder.Builder builder)
builder - builder to usepublic ReflectionBuilder<T> with(Object parameter)
parameter - Entity to setpublic T build()
build in interface org.apache.commons.lang3.builder.Builderpublic Object setFieldsWithRandomValuesFor(Object instance)
instance - instance whose fields are setCopyright © 2015. All rights reserved.