use of com.mobsandgeeks.saripaar.annotation.Order in project android-saripaar by ragunathjawahar.
the class SaripaarFieldsComparator method compare.
/**
* {@inheritDoc}
*/
@Override
public int compare(final Field lhsField, final Field rhsField) {
final Order lhsOrderAnnotation = lhsField.getAnnotation(Order.class);
final Order rhsOrderAnnotation = rhsField.getAnnotation(Order.class);
int comparison;
if (lhsOrderAnnotation == null || rhsOrderAnnotation == null) {
mOrderedFields = false;
comparison = 0;
} else {
int lhsOrder = lhsOrderAnnotation.value();
int rhsOrder = rhsOrderAnnotation.value();
comparison = lhsOrder == rhsOrder ? 0 : lhsOrder > rhsOrder ? 1 : -1;
}
return comparison;
}
Aggregations