validateEquals(Errors,String,Integer,Integer,String)   A
last analyzed

Complexity

Conditions 3

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
c 0
b 0
f 0
cc 3
loc 3
rs 10
1
package easytests.common.validators;
2
3
import org.springframework.validation.Errors;
4
5
6
/**
7
 * @author malinink
8
 */
9
public abstract class AbstractDtoValidator extends AbstractValidator {
10
    protected void validateIdEquals(Errors errors, Integer origin, Integer compare) {
11
        this.validateEquals(errors, "id", origin, compare, "Id must be equal");
12
    }
13
14
    protected void validateEquals(Errors errors, String fieldName, Integer origin, Integer compare, String message) {
15
        if (((origin == null) && (compare != null)) || ((origin != null) && !origin.equals(compare))) {
16
            reject(errors, fieldName, message);
17
        }
18
    }
19
}
20