Kenmegne
6 days ago 908e81dd173f380879d5fabeb5794d5b7a76df0e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package com.megatim.fdxconvert.model.constraint;
 
import com.megatim.fdxconvert.enums.DataType;
import com.megatim.fdxconvert.model.Tache;
import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
 
public class DelimiterValidator implements ConstraintValidator<DelimiterConstraint, Tache> {
 
    @Override
    public boolean isValid(Tache t, ConstraintValidatorContext cvc) {
 
        if (t.getDataType() != null
                && (t.getDataType().equals(DataType.CSV) || t.getDataType().equals(DataType.TXT))) {
 
            return t.getDelimiteurColonne()!= null && t.getDelimiteurLigne()!= null ;
 
        }
 
        return true;
    }
 
}