@Override public boolean equals(Object o) { if (! (o instanceof LeafNode)) return false; LeafNode<?> other = (LeafNode)o; return value == null ? other.value == null : value().equals(other.value); }
private static<REAL, NODE extends LeafNode<REAL>> List<REAL> realList(List<NODE> nodes) { List<REAL> reals = new ArrayList<>(); for(NODE node : nodes) { reals.add(node.value()); } return Collections.unmodifiableList(reals); }
/** * Converts a map of String→NODE to String→REAL, where REAL is the underlying value type. */ public static <NODE extends LeafNode<REAL>, REAL> Map<String, REAL> asValueMap(Map<String, NODE> input) { Map<String, REAL> ret = new LinkedHashMap<>(); for(String key : input.keySet()) { ret.put(key, input.get(key).value()); } return Collections.unmodifiableMap(ret); }
if (LeafNode.class.isAssignableFrom(field.getType())) { LeafNode<?> value = (LeafNode<?>) field.get(node); if (value.value() != null) { xml.print("<" + field.getName()); String v = value.getValue();