From dev-return-35518-apmail-jackrabbit-dev-archive=jackrabbit.apache.org@jackrabbit.apache.org Tue Jun 26 09:11:59 2012 Return-Path: X-Original-To: apmail-jackrabbit-dev-archive@www.apache.org Delivered-To: apmail-jackrabbit-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A2F2C9D83 for ; Tue, 26 Jun 2012 09:11:59 +0000 (UTC) Received: (qmail 8290 invoked by uid 500); 26 Jun 2012 09:11:59 -0000 Delivered-To: apmail-jackrabbit-dev-archive@jackrabbit.apache.org Received: (qmail 8049 invoked by uid 500); 26 Jun 2012 09:11:56 -0000 Mailing-List: contact dev-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@jackrabbit.apache.org Delivered-To: mailing list dev@jackrabbit.apache.org Received: (qmail 8017 invoked by uid 99); 26 Jun 2012 09:11:55 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 26 Jun 2012 09:11:55 +0000 X-ASF-Spam-Status: No, hits=-1.6 required=5.0 tests=RCVD_IN_DNSWL_MED,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [64.18.1.185] (HELO exprod6og103.obsmtp.com) (64.18.1.185) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 26 Jun 2012 09:11:46 +0000 Received: from outbound-smtp-2.corp.adobe.com ([193.104.215.16]) by exprod6ob103.postini.com ([64.18.5.12]) with SMTP ID DSNKT+l8vMqgqyGVK/agVgybJLA/x1XRvybi@postini.com; Tue, 26 Jun 2012 02:11:25 PDT Received: from inner-relay-4.eur.adobe.com (inner-relay-4b [10.128.4.237]) by outbound-smtp-2.corp.adobe.com (8.12.10/8.12.10) with ESMTP id q5Q9BNX9009858 for ; Tue, 26 Jun 2012 02:11:23 -0700 (PDT) Received: from nacas01.corp.adobe.com (nacas01.corp.adobe.com [10.8.189.99]) by inner-relay-4.eur.adobe.com (8.12.10/8.12.9) with ESMTP id q5Q9AfZ8008565 for ; Tue, 26 Jun 2012 02:11:23 -0700 (PDT) Received: from eurhub01.eur.adobe.com (10.128.4.30) by nacas01.corp.adobe.com (10.8.189.99) with Microsoft SMTP Server (TLS) id 8.3.192.1; Tue, 26 Jun 2012 02:11:14 -0700 Received: from susi.local (10.132.4.157) by eurhub01.eur.adobe.com (10.128.4.111) with Microsoft SMTP Server id 8.3.192.1; Tue, 26 Jun 2012 10:10:50 +0100 Message-ID: <4FE97CA0.7030709@apache.org> Date: Tue, 26 Jun 2012 10:10:56 +0100 From: =?ISO-8859-1?Q?Michael_D=FCrig?= User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:13.0) Gecko/20120614 Thunderbird/13.0.1 MIME-Version: 1.0 To: Subject: Re: hasProperty vs getProperty References: <4FD73DBA.9090001@gmx.de> <4FD76034.5070506@gmx.de> In-Reply-To: Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit > > > 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