* Make HopObject.get() behaviour more consistent and predictable: Return null for
non-existing properties that were previously set or are defined in the type mapping, and undefined for non-existing properties that are not defined in the type mapping.
This commit is contained in:
parent
f84ab79675
commit
3e98b1f4bf
1 changed files with 9 additions and 4 deletions
|
@ -859,13 +859,13 @@ public class HopObject extends ScriptableObject implements Wrapper, PropertyReco
|
|||
Date d = p.getDateValue();
|
||||
|
||||
if (d == null) {
|
||||
return NOT_FOUND;
|
||||
return null;
|
||||
} else {
|
||||
Object[] args = { new Long(d.getTime()) };
|
||||
try {
|
||||
return cx.newObject(core.global, "Date", args);
|
||||
} catch (JavaScriptException nafx) {
|
||||
return NOT_FOUND;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -874,7 +874,7 @@ public class HopObject extends ScriptableObject implements Wrapper, PropertyReco
|
|||
INode n = p.getNodeValue();
|
||||
|
||||
if (n == null) {
|
||||
return NOT_FOUND;
|
||||
return null;
|
||||
} else {
|
||||
return Context.toObject(n, core.global);
|
||||
}
|
||||
|
@ -884,12 +884,17 @@ public class HopObject extends ScriptableObject implements Wrapper, PropertyReco
|
|||
Object obj = p.getJavaObjectValue();
|
||||
|
||||
if (obj == null) {
|
||||
return NOT_FOUND;
|
||||
return null;
|
||||
} else {
|
||||
return Context.toObject(obj, core.global);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DbMapping dbmap = node.getDbMapping();
|
||||
if (dbmap != null && dbmap.propertyToRelation(name) != null) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return NOT_FOUND;
|
||||
|
|
Loading…
Add table
Reference in a new issue