Class ConstructorBasedGenerator<T>

java.lang.Object
de.cuioss.test.valueobjects.generator.dynamic.impl.ConstructorBasedGenerator<T>
Type Parameters:
T - identifying the type to be generated
All Implemented Interfaces:
de.cuioss.test.generator.TypedGenerator<T>

public class ConstructorBasedGenerator<T> extends Object implements de.cuioss.test.generator.TypedGenerator<T>
Author:
Oliver Wolff
  • Constructor Details

  • Method Details

    • next

      public T next()
      Specified by:
      next in interface de.cuioss.test.generator.TypedGenerator<T>
    • getType

      public Class<T> getType()
      Specified by:
      getType in interface de.cuioss.test.generator.TypedGenerator<T>
    • getGeneratorForType

      public static final <T> Optional<de.cuioss.test.generator.TypedGenerator<T>> getGeneratorForType(Class<T> type)
      Factory method for creating an instance of ConstructorBasedGenerator. It first tries to find a public, than protected, package privates, private constructor. It always uses the constructor with the fewest arguments
      Parameters:
      type - to be checked for constructors, must not be null, nor an interface, nor an annotation nor an abstract-class nor an enum
      Returns:
      an Optional on the corresponding TypedGenerator if a constructor can be found