|
|
|
@ -7,9 +7,11 @@ import java.util.List;
|
|
|
|
|
|
|
|
|
|
import lombok.Getter;
|
|
|
|
|
import lombok.Setter;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
|
|
|
|
|
@Getter
|
|
|
|
|
@Setter
|
|
|
|
|
@Slf4j
|
|
|
|
|
public class ConstraintCheck<T> {
|
|
|
|
|
|
|
|
|
|
public static <T> ConstraintCheck<T> defaultFor(T toCheck,T defaultValue){
|
|
|
|
@ -55,6 +57,8 @@ public class ConstraintCheck<T> {
|
|
|
|
|
T result=theObject;
|
|
|
|
|
if(isError()) {
|
|
|
|
|
result=theDefault;
|
|
|
|
|
log.debug("Applying default {} for current value {}",theDefault,theObject);
|
|
|
|
|
|
|
|
|
|
if(theDefault!=null && theDefault instanceof Collection) {
|
|
|
|
|
Collection defaultCollection=(Collection) theDefault;
|
|
|
|
|
ArrayList target=new ArrayList(defaultCollection);
|
|
|
|
|