easytests.common.validators.AbstractDtoValidator   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 8
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
c 0
b 0
f 0
loc 8
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
validateIdEquals 0 2 ?
A validateEquals(Errors,String,Integer,Integer,String) 0 3 3
A validateIdEquals(Errors,Integer,Integer) 0 2 1
validateEquals 0 3 ?
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