jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Dürig <mdue...@apache.org>
Subject Re: hasProperty vs getProperty
Date Tue, 26 Jun 2012 09:10:56 GMT
>
>
> 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


Mime
View raw message