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

Method toValue

src/main/java/fieldbox/io/Raft.java:306–318  ·  view source on GitHub ↗
(Dict.Prop key, Object value, Function<Box, String> alias, Predicate<Box> save)

Source from the content-addressed store, hash-verified

304 }
305
306 private Object toValue(Dict.Prop key, Object value, Function<Box, String> alias, Predicate<Box> save) throws IOException {
307
308 if (value == null) return null;
309 if (value instanceof String) return "%%java.lang.String%%" + value;
310 if (value instanceof Box)
311 return _saveBox((Box) value, alias, save);
312
313 if (value instanceof Serializable) return "%%java.io.Serializable%%" + serialize((Serializable) value);
314 if (value instanceof Class) return "%%java.lang.Class%%" + ((Class) value).getName();
315
316 // error
317 return "" + value;
318 }
319
320 private String serialize(Serializable value) throws IOException {
321 ByteArrayOutputStream a = new ByteArrayOutputStream();

Callers 1

_saveBoxMethod · 0.95

Calls 3

_saveBoxMethod · 0.95
serializeMethod · 0.95
getNameMethod · 0.45

Tested by

no test coverage detected