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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic final <T> Optional<de.cuioss.test.generator.TypedGenerator<T>>
getGeneratorForType
(Class<T> type) Factory method for creating an instance ofConstructorBasedGenerator
.getType()
next()
-
Constructor Details
-
ConstructorBasedGenerator
public ConstructorBasedGenerator()
-
-
Method Details
-
next
- Specified by:
next
in interfacede.cuioss.test.generator.TypedGenerator<T>
-
getType
- Specified by:
getType
in interfacede.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 ofConstructorBasedGenerator
. 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 correspondingTypedGenerator
if a constructor can be found
-