in src/main/java/org/apache/sling/scripting/javascript/wrapper/ScriptableNode.java [362:374]
private Scriptable wrap(Value value) throws ValueFormatException, IllegalStateException, RepositoryException {
Object javaObject;
if (value.getType() == PropertyType.REFERENCE) {
String nodeUuid = value.getString();
javaObject = node.getSession().getNodeByUUID(nodeUuid);
} else {
javaObject = toJavaObject(value);
}
return ScriptRuntime.toObject(this, javaObject);
}