org.unitils.objectvalidation.objectcreator.generator
Class PrimitiveGenerator

java.lang.Object
  extended by org.unitils.objectvalidation.objectcreator.generator.PrimitiveGenerator
All Implemented Interfaces:
Generator

public class PrimitiveGenerator
extends Object
implements Generator

The primitive generator is capable of generating java primitive types and there counterparts. Boolean, Integer, BigInteger, Float, Double, BigDecimal, Long, Short, Character, String, Date, Date, Calendar, Timestamp, Byte

Since:
Feb 20, 2012
Author:
Jeroen Horemans

Constructor Summary
PrimitiveGenerator()
           
 
Method Summary
protected  Object generateJavaDefaultClass(Class<?> type)
           
 Object generateObject(Class<?> clazz, List<Object> input, List<Class<?>> inputClasses, List<TreeNode> genericSubTypes)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PrimitiveGenerator

public PrimitiveGenerator()
Method Detail

generateObject

public Object generateObject(Class<?> clazz,
                             List<Object> input,
                             List<Class<?>> inputClasses,
                             List<TreeNode> genericSubTypes)
                      throws Exception
Specified by:
generateObject in interface Generator
Parameters:
clazz - The class of the object to generate
input - the parameters to give to the constructor
inputClasses - the types of the constructor parameters
genericSubTypes - if clazz has generic parameters here they should be entered
Returns:
Object a randomly generated object or null if it was impossible to generate
Throws:
Exception - if illegal calls to object constructors.

generateJavaDefaultClass

protected Object generateJavaDefaultClass(Class<?> type)


Copyright © 2013-2015. All Rights Reserved.