This snippet throws an NullPointerException due to the fact that its unboxed to a primitive type and Long.longValue() is called, right?
NullPointerException
Long.longValue()
Tha
Since Java 8 SE there is also Optional.ofNullable
long value = Optional.ofNullable(obj.getProperty(propertyModel.getName())).orElse(0L)));