org.unitils.objectvalidation.objectcreator.generator
Class WildCardTypeGenerator

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

public class WildCardTypeGenerator
extends Object
implements Generator

Generates objects of type WildcardTypeImpl.

Since:
1.1.8
Author:
Willemijn Wouters

Constructor Summary
protected WildCardTypeGenerator(ObjectCreator objectCreator)
           
 
Method Summary
 Object generateObject(Class<?> clazz, List<Object> input, List<Class<?>> inputClasses, List<TreeNode> genericSubTypes)
           
 Object generateObjectFromWildCard(sun.reflect.generics.reflectiveObjects.WildcardTypeImpl wildCard)
           
protected  Set<?> getClassesOfSubtypes(sun.reflect.generics.reflectiveObjects.WildcardTypeImpl wildcard, Set<?> allClasses)
          Get the subtypes of a class (based on a wildcard).
protected  Set<Class<?>> getClassesOfSuperType(sun.reflect.generics.reflectiveObjects.WildcardTypeImpl wildcard, Set<Class<?>> allClasses)
          An WildcardTypeImpl can have multiple lowerbounds (super).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WildCardTypeGenerator

protected WildCardTypeGenerator(ObjectCreator objectCreator)
Parameters:
objectCreator -
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.
See Also:
Generator.generateObject(java.lang.Class, java.util.List, java.util.List, java.util.List)

generateObjectFromWildCard

public Object generateObjectFromWildCard(sun.reflect.generics.reflectiveObjects.WildcardTypeImpl wildCard)

getClassesOfSubtypes

protected Set<?> getClassesOfSubtypes(sun.reflect.generics.reflectiveObjects.WildcardTypeImpl wildcard,
                                      Set<?> allClasses)
Get the subtypes of a class (based on a wildcard).

Parameters:
wildcard: - the wildcard of the generic
allClasses: - A collection where the Generator should add the found classes.
Returns:
Set

getClassesOfSuperType

protected Set<Class<?>> getClassesOfSuperType(sun.reflect.generics.reflectiveObjects.WildcardTypeImpl wildcard,
                                              Set<Class<?>> allClasses)
An WildcardTypeImpl can have multiple lowerbounds (super).

Parameters:
wildcard: - the wildcard of the generic
allClasses: - A collection where the Generator should add the found classes.
Returns:
Set


Copyright © 2013-2015. All Rights Reserved.