package com.gci.boot.annotation.repeat.handle;

import com.gci.boot.annotation.repeat.FieldRepeat;
import com.gci.boot.annotation.repeat.TableRepeat;
import org.apache.poi.ss.formula.functions.T;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;

/**
 * @author 24642
 */
public class TableRepeatHandle implements ConstraintValidator<TableRepeat,Object> {
    private Class<T> cClass;
    /**
     *
     */
    @Override
    public void initialize(TableRepeat constraintAnnotation) {
        this.cClass = (Class<T>) constraintAnnotation.aClass();
    }

    @Override
    public boolean isValid(Object o, ConstraintValidatorContext constraintValidatorContext) {
        return TableRepeatUtils.fieldRepeat(o,cClass,constraintValidatorContext);
    }
}
