Perhaps we should provide methods such as

public static Xxx getXxxProperty(Node node, String propertyName, Xxx
default) {
   try {
     return node.getProperty(propertyName).getXxx();
   } catch (PathNotFoundException e) {
     return default;
   }
}

in JcrUtils.

So that you can write:

final Xxx x = JcrUtils.getXxxProperty(node, "prop", null);
if (x != null) {
   // etc

Yes I think this could be useful. Also since hasProperty() is internally implemented through try-catching getProperty in Jackrabbit. So we don't lose anything with this code.

Michael



--
Unico

Reply via email to