#22461 #1
|
@ -7,9 +7,11 @@ import java.util.List;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
|
@Slf4j
|
||||||
public class ConstraintCheck<T> {
|
public class ConstraintCheck<T> {
|
||||||
|
|
||||||
public static <T> ConstraintCheck<T> defaultFor(T toCheck,T defaultValue){
|
public static <T> ConstraintCheck<T> defaultFor(T toCheck,T defaultValue){
|
||||||
|
@ -55,6 +57,8 @@ public class ConstraintCheck<T> {
|
||||||
T result=theObject;
|
T result=theObject;
|
||||||
if(isError()) {
|
if(isError()) {
|
||||||
result=theDefault;
|
result=theDefault;
|
||||||
|
log.debug("Applying default {} for current value {}",theDefault,theObject);
|
||||||
|
|
||||||
if(theDefault!=null && theDefault instanceof Collection) {
|
if(theDefault!=null && theDefault instanceof Collection) {
|
||||||
Collection defaultCollection=(Collection) theDefault;
|
Collection defaultCollection=(Collection) theDefault;
|
||||||
ArrayList target=new ArrayList(defaultCollection);
|
ArrayList target=new ArrayList(defaultCollection);
|
||||||
|
|
|
@ -85,6 +85,8 @@ public class Files {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String fixFilename(String toFix) {
|
public static String fixFilename(String toFix) {
|
||||||
|
if(toFix.startsWith("\\."))
|
||||||
|
toFix=toFix.replaceFirst("\\.","_");
|
||||||
String extension="";
|
String extension="";
|
||||||
if(toFix.contains(".")) {
|
if(toFix.contains(".")) {
|
||||||
//preserve extension
|
//preserve extension
|
||||||
|
|
Loading…
Reference in New Issue