Kenmegne
2026-02-10 fbc7dbdc270695b383e7d6e9eeef06d3b2612067
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
 */
package com.megatim.generatetxt.constraints;
 
import com.megatim.generatetxt.enums.DataType;
import com.megatim.generatetxt.pojo.FileToValidate;
import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
 
/**
 *
 * @author ASUS
 */
public class FileToValidateDelimiterValidator  implements ConstraintValidator<FileToValidateDelimiterConstraint, FileToValidate> {
    
    @Override
    public boolean isValid(FileToValidate 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;
    }
}