org.unitils.objectvalidation
Interface ObjectCreator
- All Known Implementing Classes:
- BaseObjectCreator, ObjectCreatorMockedFieldsImpl
public interface ObjectCreator
The responsability of ObjectCreator is to create object of the type provided.
The default ones are :
-
EnumGenerator : That will generate a random enumeration.
-
PrimitiveGenerator : That will handle all those field types :
- int,
Integer, boolean, Boolean, float, Float, double, Double,
BigDecimal, long, Long, short, Short, byte, Byte
- char,
Character, String
-
Date, Date, Timestamp, Calendar
- Subtype of
Exception
-
CollectionGenerator :
- It will handle the classes assignables from :
Map, Set, List and the arrays
- It will go down the tree even if types like this : HashMap<String, HashMap<String, List<String>>>
- It will generate for each of those field a random number of items between 1 and 10.
BuilderGenerator :
- It will check if the class specifies a "build" method and will fill in the Builder object fields by reflection.
-
LastResortGenerator :
-
It will generate the class through reflection, using all the fields collected by the
TreeNodeCreator.
- Since:
- Oct 18, 2013
- Author:
- Matthieu Mestrez
createRandomObject
Object createRandomObject(Type bean)
createRandomObject
Object createRandomObject(TreeNode bean)
addGenerators
void addGenerators(Generator... generator)
getGenerators
List<Generator> getGenerators()
getGeneratorOfType
<T> T getGeneratorOfType(Class<T> generatorType)
getGenerator
Generator getGenerator()
Copyright © 2013-2015. All Rights Reserved.