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

org.chobit.common.validation.ChineseOnly Maven / Gradle / Ivy

The newest version!
package org.chobit.common.validation;

import jakarta.validation.Constraint;
import jakarta.validation.Payload;

import java.lang.annotation.*;

/**
 * 检查是否全部是汉字
 *
 * @author robin
 */
@Documented
@Constraint(
        validatedBy = {ChineseOnlyValidator.class}
)
@Target({ElementType.METHOD, ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
public @interface ChineseOnly {


    Class[] groups() default {};


    Class[] payload() default {};


    /**
     * 提示消息
     *
     * @return 提示消息
     */
    String message() default "存在非法字符";


    /**
     * 是否允许中文标点符号
     *
     * @return true 允许, false 不允许
     */
    boolean allowPunctuation() default false;

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy