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

love.keeping.starter.web.components.validation.UploadUrlValidator Maven / Gradle / Ivy

The newest version!
package love.keeping.starter.web.components.validation;

import love.keeping.starter.common.constants.PatternPool;
import love.keeping.starter.common.utils.RegUtil;
import love.keeping.starter.common.utils.StringUtil;
import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;

/**
 * 上传文件url校验 如果参数是null 则通过校验
 *
 * @author Keeping
 */
public class UploadUrlValidator implements ConstraintValidator {

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

    return StringUtil.isEmpty(value) || RegUtil.isMatch(PatternPool.PATTERN_HTTP_URL, value);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy