You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by Michael D Robinson <md...@thoughtworks.com> on 2009/10/26 06:32:46 UTC
org.apache.jackrabbit.jcr2spi.NodeImpl question
Hi,
I was reviewing source code[1], and found a bit I didn't understand:
317 public Property setProperty(String name, String value) throws
ValueFormatException, VersionException, LockException,
ConstraintViolationException, RepositoryException {
318 // validation performed in subsequent method
319 Value v = (value == null) ? null :
session.getValueFactory().createValue(value, PropertyType.STRING);
320 return setProperty(name, v, PropertyType.UNDEFINED);
321 }
Why does this code create a value of PropertyType.STRING, and then use
it to set a property of type PropertyType.UNDEFINED?
Thanks.
-Michael Robinson
[1] http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java?view=markup
Re: org.apache.jackrabbit.jcr2spi.NodeImpl question
Posted by Marcel Reutegger <ma...@gmx.net>.
Hi,
IIUC, this tells setProperty() on line 320 that it does not need to
convert the value to another type and that it should use the type
present on the passed value instance.
though, it seems inconsistent because all other setProperty() methods
pass the type that is also present in the value.
regards
marcel
2009/10/26 Michael D Robinson <md...@thoughtworks.com>:
> Hi,
>
> I was reviewing source code[1], and found a bit I didn't understand:
>
> 317 public Property setProperty(String name, String value) throws
> ValueFormatException, VersionException, LockException,
> ConstraintViolationException, RepositoryException {
> 318 // validation performed in subsequent method
> 319 Value v = (value == null) ? null :
> session.getValueFactory().createValue(value, PropertyType.STRING);
> 320 return setProperty(name, v, PropertyType.UNDEFINED);
> 321 }
>
> Why does this code create a value of PropertyType.STRING, and then use
> it to set a property of type PropertyType.UNDEFINED?
>
> Thanks.
>
> -Michael Robinson
>
> [1] http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java?view=markup
>