-
public final class ConstructorCodeGenerator<T extends Object>This utility is used to generate the code need to construct an object. It is useful for printing out a MavericksState instance's constructor code when setting up a test for that state.
It uses recursion to analyze the given object instance and generates code needed to construct another instance of the object containing the same data.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final classConstructorCodeGenerator.EnclosingClass
-
Field Summary
Fields Modifier and Type Field Description private final StringconstructorCodeprivate final StringlazyPropertyToCreateObjectprivate final List<String>imports
-
Constructor Summary
Constructors Constructor Description ConstructorCodeGenerator(T objectToCopy, Integer listTruncationThreshold, Integer stringTruncationThreshold, List<TypePrinter<?>> customTypePrinters)
-
Method Summary
Modifier and Type Method Description final StringgetConstructorCode()The code needed to reconstruct objectToCopy. final StringgetLazyPropertyToCreateObject()Wraps constructorCode in a property that is lazily initialized. final List<String>getImports()The fully qualified names of all classes and functions that are used in the code. -
-
Constructor Detail
-
ConstructorCodeGenerator
ConstructorCodeGenerator(T objectToCopy, Integer listTruncationThreshold, Integer stringTruncationThreshold, List<TypePrinter<?>> customTypePrinters)
-
-
Method Detail
-
getConstructorCode
final String getConstructorCode()
The code needed to reconstruct objectToCopy.
-
getLazyPropertyToCreateObject
final String getLazyPropertyToCreateObject()
Wraps constructorCode in a property that is lazily initialized.
-
getImports
final List<String> getImports()
The fully qualified names of all classes and functions that are used in the code.
-
-
-
-