public static Map<String, Object> getRouterSpec(ZkNodeProps props) { Map<String, Object> map = new LinkedHashMap<>(); for (String s : props.keySet()) { if (s.startsWith("router.")) { map.put(s.substring(7), props.get(s)); } } if (map.get("name") == null) { map.put("name", DEFAULT_NAME); } return map; }
public static Map<String,Object> getRouterSpec(ZkNodeProps props){ Map<String,Object> map = new LinkedHashMap<>(); for (String s : props.keySet()) { if(s.startsWith("router.")){ map.put(s.substring(7), props.get(s)); } } Object o = props.get("router"); if (o instanceof String) { map.put("name", o); } else if (map.get("name") == null) { map.put("name", DEFAULT_NAME); } return map; }