jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marcel Reutegger" <marcel.reuteg...@day.com>
Subject Re: Multivalue or single?
Date Tue, 20 Jun 2006 07:43:15 GMT
On 6/19/06, David Kennedy <davek@us.ibm.com> wrote:
> If I have a node, the name of a property and a single value, how can I
> determine if I need to add the value to an array and use the multivalue
> setter or not?

You'll have to ask the NodeType of the node:

NodeType nt = node.getPrimaryNodeType();
if (nt.canSetProperty("propName", mySingleValue)) {
  node.setProperty("propName", mySingleValue);
} else {
  node.setProperty("propName", new Value[]{mySingleValue});


View raw message