MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / possibleToString

Method possibleToString

src/main/java/fieldbox/boxes/Box.java:690–717  ·  view source on GitHub ↗
(Box box, Dict.Prop q)

Source from the content-addressed store, hash-verified

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

Callers 1

assembleCompletionsMethod · 0.95

Calls 7

upwardsMethod · 0.80
isPresentMethod · 0.80
getMethod · 0.65
applyMethod · 0.65
getMethodMethod · 0.65
findMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected