mirror of
https://gitee.com/jmix/cuba.git
synced 2024-12-01 10:47:37 +08:00
PL-7417 Application properties screen does not support Date values with custom @Factory and @Stringify
This commit is contained in:
parent
13989abb00
commit
64be6be168
@ -44,6 +44,7 @@ import javax.inject.Inject;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.text.ParseException;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ -340,5 +341,20 @@ public class AppPropertiesLocator {
|
||||
else
|
||||
entity.setDataTypeName(Datatypes.getNN(String.class).getName());
|
||||
}
|
||||
|
||||
String dataTypeName = entity.getDataTypeName();
|
||||
if (!dataTypeName.equals("enum")) {
|
||||
Datatype datatype = Datatypes.get(dataTypeName);
|
||||
String v = null;
|
||||
try {
|
||||
v = entity.getDefaultValue();
|
||||
datatype.parse(v);
|
||||
v = entity.getCurrentValue();
|
||||
datatype.parse(v);
|
||||
} catch (ParseException e) {
|
||||
log.debug("Cannot parse '{}' with {} datatype, using StringDatatype for property {}", v, datatype, entity.getName());
|
||||
entity.setDataTypeName(Datatypes.getNN(String.class).getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user