public class ComplexComparisonResultBuilder<T>
extends java.lang.Object
Class provides functionality to build complex comparison results for a single type. Class specified in the constructor represents the compared type. All created property keys will be pointing to this type. Actual and expected values at the end of building process also should be instances of the specified type.
| Constructor and Description |
|---|
ComplexComparisonResultBuilder(java.lang.Class<? super T> type) |
| Modifier and Type | Method and Description |
|---|---|
ComplexComparisonResultBuilder<T> |
addResult(java.lang.String propertyName,
ComparisonResult result)
Store specified result.
|
ComplexComparisonResultBuilder<T> |
apply(java.lang.String propertyName,
java.lang.Object actual,
java.lang.Object expected)
Perform comparison of the specified values using default performer, and store the result.
|
<X> ComplexComparisonResultBuilder<T> |
apply(java.lang.String propertyName,
X actual,
X expected,
ComparisonPerformer<? super X> performer)
Perform comparison of the specified values using specified performer, and store the result.
|
ComplexComparisonResult |
build(T actual,
T expected,
ComparisonPerformer<? super T> performer)
Build complex result using map of stored results.
|
ClassPropertyKey |
createKey(java.lang.String name)
Creates key with the specified name and the type specified at the constructor
|
ComparisonPerformer<java.lang.Object> |
getDefaultComparisonPerformer() |
java.util.Map<ClassPropertyKey,ComparisonResult> |
getPropertyResults() |
java.lang.Class<?> |
getType() |
ComplexComparisonResultBuilder<T> |
setDefaultComparisonPerformer(ComparisonPerformer<java.lang.Object> defaultComparisonPerformer) |
public ComplexComparisonResultBuilder(java.lang.Class<? super T> type)
public ClassPropertyKey createKey(java.lang.String name)
public java.lang.Class<?> getType()
public ComplexComparisonResultBuilder<T> setDefaultComparisonPerformer(ComparisonPerformer<java.lang.Object> defaultComparisonPerformer)
public ComparisonPerformer<java.lang.Object> getDefaultComparisonPerformer()
public java.util.Map<ClassPropertyKey,ComparisonResult> getPropertyResults()
public ComplexComparisonResultBuilder<T> apply(java.lang.String propertyName, java.lang.Object actual, java.lang.Object expected)
Perform comparison of the specified values using default performer, and store the result. Property key
is created from the specified name using createKey(String) method.
public <X> ComplexComparisonResultBuilder<T> apply(java.lang.String propertyName, X actual, X expected, ComparisonPerformer<? super X> performer)
Perform comparison of the specified values using specified performer, and store the result. Property key
is created from the specified name using createKey(String) method.
Equal to performing comparison manually and using addResult(String, ComparisonResult) to store
result. But improves readability.
public ComplexComparisonResultBuilder<T> addResult(java.lang.String propertyName, ComparisonResult result)
Store specified result. Property key is created from the specified name
using createKey(String) method.
public ComplexComparisonResult build(T actual, T expected, ComparisonPerformer<? super T> performer)