tech.guyi.ipojo.compile.lib.configuration.parse.ExtendFieldFactory Maven / Gradle / Ivy
package tech.guyi.ipojo.compile.lib.configuration.parse;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
public class ExtendFieldFactory {
private static final String OverrideName = "override";
private static final String ValueName = "value";
public static boolean isOverride(Map map){
return Boolean.parseBoolean(map.getOrDefault(OverrideName,true).toString());
}
private static boolean isSerial(Object value){
return (value instanceof String)
|| (value instanceof Number)
|| (value instanceof Boolean);
}
private static Object select(Object source,Object target){
if (target == null){
return source;
}
if (source == null){
return target;
}
if ((source instanceof Map) && (target instanceof Map)){
return extendMap((Map) source,(Map) target);
}
if ((source instanceof Map) && isSerial(target)){
return extendMapSerial((Map) source,(Serializable) target);
}
if ((source instanceof Map) && (target instanceof List)){
return extendMapList((Map) source,(List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy