Skip to content
Snippets Groups Projects
Commit b1e4a90d authored by OZGCloud's avatar OZGCloud
Browse files

OZG-2566 OZG-2684 improve code

parent 8c19bb04
No related merge requests found
......@@ -86,21 +86,10 @@ public interface CommandBodyMapper {
}
default Map<String, Object> fromObjectToMap(Object object) {
var objectMap = new HashMap<String, Object>();
new BeanMap(object).entrySet().forEach(entry -> {
var keyString = entry.getKey().toString();
if (shouldMap(keyString)) {
objectMap.put(keyString, checkEnumValue(entry.getValue()));
}
});
return objectMap;
}
private boolean shouldMap(String key) {
return !key.equals("class") && !key.equals("version");
return new BeanMap(object).entrySet().stream()
.filter(IS_NOT_CLASS_VALUE)
.filter(IS_NOT_VERSION_VALUE)
.collect(HashMap::new, (map, entry) -> map.put(entry.getKey().toString(), checkEnumValue(entry.getValue())), Map::putAll);
}
private Object checkEnumValue(Object entryValue) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment