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

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

There is a newer version: 0.1.3.4
Show newest version
package org.chobit.commons.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