com.github.fashionbrot.exception.ValidatedException Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of validation Show documentation
Show all versions of validation Show documentation
validation 参数验证 https://github.com/fashionbrot/validation
The newest version!
package com.github.fashionbrot.exception;
import com.github.fashionbrot.constraint.Violation;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.List;
@EqualsAndHashCode(callSuper=false)
@Data
public class ValidatedException extends RuntimeException {
private String fieldName;
private String msg;
private String annotationName;
private Object value;
/**
* Array or List
* value index
*/
private Integer valueIndex;
private List violations;
public ValidatedException(List violations) {
super();
this.violations = violations;
}
public ValidatedException(String fieldName,String msg,String annotationName,Object value,Integer valueIndex){
super();
this.fieldName = fieldName;
this.msg = msg;
this.annotationName = annotationName;
this.value = value;
this.valueIndex = valueIndex;
}
public static void throwMsg(String fieldName,String msg,String annotationName,Object value,Integer valueIndex){
throw new ValidatedException(fieldName,msg,annotationName,value,valueIndex);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy