All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.cybermkd.validation.InsideValidator Maven / Gradle / Ivy

There is a newer version: 1.0.8.2
Show newest version
package com.cybermkd.validation;

import com.cybermkd.constraints.Inside;

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

/**
 * 创建人:T-baby
 * 创建日期: 16/8/3
 * 文件描述:
 */
public class InsideValidator implements ConstraintValidator {

    private String[] value;

    @Override
    public void initialize(Inside inside) {
        value = inside.value();
    }

    @Override
    public boolean isValid(String s, ConstraintValidatorContext constraintValidatorContext) {
        for (String text : value) {
            if (text.equals(s)) {
                return true;
            }
        }
        return false;
    }


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy