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

org.chobit.commons.validation.NoEmojiValidator Maven / Gradle / Ivy

There is a newer version: 0.1.3.4
Show newest version
package org.chobit.commons.validation;


import jakarta.validation.ConstraintValidator;
import jakarta.validation.ConstraintValidatorContext;

import static org.chobit.commons.enums.CommonRegexPattern.EMOJI_CONTAINED;
import static org.chobit.commons.utils.StrKit.isBlank;

/**
 * @author robin
 */
public class NoEmojiValidator implements ConstraintValidator {


    @Override
    public boolean isValid(String value, ConstraintValidatorContext context) {

        if (isBlank(value)) {
            return true;
        }

        return !EMOJI_CONTAINED.matches(value);
    }


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy