jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Wechner <michael.wech...@wyona.com>
Subject Re: getString for multi-valued properties
Date Sun, 27 Feb 2005 23:26:14 GMT
Tobias Strasser wrote:

>>Is this a feature or a bug?
>this works as specified:
>see 6.2.4:
>If this property is multi-valued, this method throws a ValueFormatException

right, but I used the Property.getString() method and thought
that this method would just concatenate the values resp. their string 
representation, especially
since there doesn't seem to be a getStrings() method within the API

I took it from the first steps example, but I think I still used a 
rather old version ;-) which used

System.out.println(p.getPath() + "=" + p.getString());

for all cases (multivalued and singlevalued)

but I see from the Javadoc that also the getString method

    A string representation of the value of this property. 
    - if conversion to a string is not possible or if the property is

but does that make sense if there isn't a getStrings() method or would
it make sense to add a getStrings() method to the API?

Sorry, if I might confuse stuff here.

>>if (p.getDefinition().isMultiple()) {
>>                Value[] values = p.getValues();
>>Is this the way how to do it?
>>Just being curious, why does Value or Property of the "cqfs" implementation
>>not implement the "toString()" method for convenience?
>in general, the toString() should only be used for debugging purposos,
>giving a human readable description about the object.

I guess I just thought about very simple String objects
as property values and didn't consider anything else, but I think I
get your point

> IMO, it should
>not modify the state of the object (e.g. read a stream, modify fields)
>or throw uncaught exceptions. so the toString() of a value or property
>should not return the content of the value if it would modify the

I don't fully understand to be honest. Why should getValue
or getString modify the state or whatsoever?

>btw: the Value or Property is implemented by the jcr api and
>jackrabbit. this has nothing to do with 'cqfs'.

I thought it might be an implementation bug and didn't check that
ValueFormatException is part of the interface definition


well, maybe I should start using Eclipse ;-)



>cheers, tobi

Michael Wechner
Wyona Inc.  -   Open Source Content Management   -   Apache Lenya
http://www.wyona.com                      http://lenya.apache.org
michael.wechner@wyona.com                        michi@apache.org

View raw message