| 688 | .filter(x -> x != null) |
| 689 | .collect(Collectors.toList()); |
| 690 | } |
| 691 | |
| 692 | private String possibleToString(Box box, Dict.Prop q) { |
| 693 | // if (!box.properties.has(q)) return ""; |
| 694 | |
| 695 | Optional m = box.find(q, box.upwards()).findFirst(); |
| 696 | if (!m.isPresent()) return "(unset)"; |
| 697 | |
| 698 | Object v = m.get(); |
| 699 | if (v instanceof Box.FunctionOfBoxValued) { |
| 700 | v = ((Box.FunctionOfBoxValued) v).apply(this); |
| 701 | } |
| 702 | |
| 703 | // does this v have something to say? |
| 704 | |
| 705 | if (v == null) |
| 706 | return "null"; |
| 707 | |
| 708 | try { |
| 709 | if (v.getClass().getMethod("toString").getDeclaringClass() != Object.class) { |
| 710 | String r = " = " + v; |
| 711 | if (r.length() < 40) |
| 712 | return r; |
| 713 | } |
| 714 | |
| 715 | } catch (NoSuchMethodException e) { |
| 716 | e.printStackTrace(); |
| 717 | } |
| 718 | return ""; |
| 719 | } |
| 720 | |