Top Description Fields Constructors Methods
org.assertj.core.internal

public Class FieldByFieldComparator

extends Object
implements Comparator<Object>
Class Inheritance
All Implemented Interfaces
java.util.Comparator
Known Direct Subclasses
org.assertj.core.internal.IgnoringFieldsComparator, org.assertj.core.internal.OnFieldsComparator
Annotations
@Deprecated
Static Imports
java.lang.String.format, java.util.stream.Collectors.toList, org.assertj.core.internal.ComparatorBasedComparisonStrategy.NOT_EQUAL, .TypeComparators.defaultTypeComparators, org.assertj.core.util.Strings.join

Deprecated

This comparator is deprecated because it performs a shallow field by field comparison, i.e. elements are compared field by field but the fields are compared with equals, use AbstractIterableAssert#usingRecursiveFieldByFieldElementComparator(RecursiveComparisonConfiguration) or AbstractObjectAssert#usingRecursiveComparison() instead to perform a true recursive comparison.

Deprecated javadoc

Compares objects field/property by field/property including private fields unless Assertions#setAllowComparingPrivateFields(boolean) has been called with false.

Field Summary

Modifier and TypeField and Description
protected final Map<String, Comparator<?>>
protected final TypeComparators

Constructor Summary

AccessConstructor and Description
public
FieldByFieldComparator(Map<String, Comparator<?>> comparatorsByPropertyOrField, TypeComparators typeComparators)

public

Method Summary

Modifier and TypeMethod and Description
protected boolean
areEqual(Object actual, Object other)

public int
compare(Object
the first object to be compared.
actual
,
Object
the second object to be compared.
other
)

Implements java.util.Comparator.compare.

Compares its two arguments for order.
protected String
protected String
protected String
protected String
private static String
private static boolean
isNullOrEmpty(TypeComparators comparatorByType)

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

comparatorsByPropertyOrFieldback to summary
protected final Map<String, Comparator<?>> comparatorsByPropertyOrField
comparatorsByTypeback to summary
protected final TypeComparators comparatorsByType

Constructor Detail

FieldByFieldComparatorback to summary
public FieldByFieldComparator(Map<String, Comparator<?>> comparatorsByPropertyOrField, TypeComparators typeComparators)
FieldByFieldComparatorback to summary
public FieldByFieldComparator()

Method Detail

areEqualback to summary
protected boolean areEqual(Object actual, Object other)
compareback to summary
public int compare(Object actual, Object other)

Implements java.util.Comparator.compare.

Doc from java.util.Comparator.compare.

Compares its two arguments for order. Returns a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.

The implementor must ensure that signum(compare(x, y)) == -signum(compare(y, x)) for all x and y. (This implies that compare(x, y) must throw an exception if and only if compare(y, x) throws an exception.)

The implementor must also ensure that the relation is transitive: ((compare(x, y)>0) && (compare(y, z)>0)) implies compare(x, z)>0.

Finally, the implementor must ensure that compare(x, y)==0 implies that signum(compare(x, z))==signum(compare(y, z)) for all z.

Parameters
actual:Object

the first object to be compared.

other:Object

the second object to be compared.

Returns:int

a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.

Annotations
@Override
describeFieldComparatorsByNameback to summary
protected String describeFieldComparatorsByName()
describeFieldComparatorsByTypeback to summary
protected String describeFieldComparatorsByType()
describeUsedComparatorsback to summary
protected String describeUsedComparators()
descriptionback to summary
protected String description()
formatFieldComparatorback to summary
private static String formatFieldComparator(Map.Entry<String, Comparator<?>> next)
isNullOrEmptyback to summary
private static boolean isNullOrEmpty(TypeComparators comparatorByType)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object

Annotations
@Override