Hi everyone,

I have an issue which I would like your opinion on... It's mostly a question
of code aesthetics, to be honest, but still...

When I look in my code I see myNode.getProperty(SOME_PROP, null);
everyehere... The reason for this is that I if I called
myNode.getProperty(SOME_PROP) I'd have to check for org.neo4j.api.core.
NotFoundException everywhere that I read properties that are not mandatory.
What if myNode.getProperty(SOME_PROP) was to return null instead? The doc
says explicitly that you can't persist null. If
myNode.getProperty(SOME_PROP) where to return null this would mean, without
any doubt, that the property does not exist, right? The upside to this would
be that I wouldn't have to use the DefaultReturnValue null everywhere. And
the argument that I'd have to null-check everywhere is kind of moot since I
already return null as DefaultReturnValue.

In my case my domain objects extend a NodeDelegate, which takes an
underlaying node in the constructor. This means that I can use
getProperty(SOME_PROP, null) everytime I call getProperty(SOME_PROP)... but
the question is if there are any downsides to doing that? What are your
thoughts on this?

Best,
Mattias Ask
_______________________________________________
Neo mailing list
[email protected]
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to