You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@chemistry.apache.org by Florent Guillaume <fg...@nuxeo.com> on 2010/10/07 17:20:11 UTC

getPropertyMultivalue -> getPropertyValue

Hi,

I don't think I got comments on this earlier proposal I made:

I don't like this part of the CmisObject API and find it hard to use:
   <T> T getPropertyValue(String id);
   <T> List<T> getPropertyMultivalue(String id);

I propose to change it to:
   <T> T getPropertyValue(String id);

Which would returns a single value for a single-valued property, and a
List for a multi-valued property. If the client knew which of the two
methods to call, then it knows if it expects a List or not so it
doesn't change expressivity.

I haven't yet tried to do the changes in the code but I don't
anticipate too many difficulties. What do you think?

Florent

-- 
Florent Guillaume, Director of R&D, Nuxeo
Open Source, Java EE based, Enterprise Content Management (ECM)
http://www.nuxeo.com   http://www.nuxeo.org   +33 1 40 33 79 87

Re: getPropertyMultivalue -> getPropertyValue

Posted by Stephan Klevenz <st...@klaeff.de>.
+1



Von meinem KLÄFF-Pad gesendet

Am 07.10.2010 um 17:22 schrieb Florent Guillaume <fg...@nuxeo.com>:

> Also I'd add to Property<T> a method:
>  <U> U getValue();
> That would do the same (we cannot use <T> here).
> 
> Florent
> 
> On Thu, Oct 7, 2010 at 5:20 PM, Florent Guillaume <fg...@nuxeo.com> wrote:
>> Hi,
>> 
>> I don't think I got comments on this earlier proposal I made:
>> 
>> I don't like this part of the CmisObject API and find it hard to use:
>>   <T> T getPropertyValue(String id);
>>   <T> List<T> getPropertyMultivalue(String id);
>> 
>> I propose to change it to:
>>   <T> T getPropertyValue(String id);
>> 
>> Which would returns a single value for a single-valued property, and a
>> List for a multi-valued property. If the client knew which of the two
>> methods to call, then it knows if it expects a List or not so it
>> doesn't change expressivity.
>> 
>> I haven't yet tried to do the changes in the code but I don't
>> anticipate too many difficulties. What do you think?
>> 
>> Florent
>> 
>> --
>> Florent Guillaume, Director of R&D, Nuxeo
>> Open Source, Java EE based, Enterprise Content Management (ECM)
>> http://www.nuxeo.com   http://www.nuxeo.org   +33 1 40 33 79 87
>> 
> 
> 
> 
> -- 
> Florent Guillaume, Director of R&D, Nuxeo
> Open Source, Java EE based, Enterprise Content Management (ECM)
> http://www.nuxeo.com   http://www.nuxeo.org   +33 1 40 33 79 87

Re: getPropertyMultivalue -> getPropertyValue

Posted by Florian Müller <fl...@alfresco.com>.
Sounds reasonable. +1

It may break some applications out there using OpenCMIS. So we should 
schedule new a release at some point to help people keeping up with the 
development.


- Florian

On 07/10/2010 16:22, Florent Guillaume wrote:
> Also I'd add to Property<T>  a method:
>    <U>  U getValue();
> That would do the same (we cannot use<T>  here).
>
> Florent
>
> On Thu, Oct 7, 2010 at 5:20 PM, Florent Guillaume<fg...@nuxeo.com>  wrote:
>> Hi,
>>
>> I don't think I got comments on this earlier proposal I made:
>>
>> I don't like this part of the CmisObject API and find it hard to use:
>>    <T>  T getPropertyValue(String id);
>>    <T>  List<T>  getPropertyMultivalue(String id);
>>
>> I propose to change it to:
>>    <T>  T getPropertyValue(String id);
>>
>> Which would returns a single value for a single-valued property, and a
>> List for a multi-valued property. If the client knew which of the two
>> methods to call, then it knows if it expects a List or not so it
>> doesn't change expressivity.
>>
>> I haven't yet tried to do the changes in the code but I don't
>> anticipate too many difficulties. What do you think?
>>
>> Florent
>>
>> --
>> Florent Guillaume, Director of R&D, Nuxeo
>> Open Source, Java EE based, Enterprise Content Management (ECM)
>> http://www.nuxeo.com   http://www.nuxeo.org   +33 1 40 33 79 87
>>
>
>
>


Re: getPropertyMultivalue -> getPropertyValue

Posted by Florent Guillaume <fg...@nuxeo.com>.
Also I'd add to Property<T> a method:
  <U> U getValue();
That would do the same (we cannot use <T> here).

Florent

On Thu, Oct 7, 2010 at 5:20 PM, Florent Guillaume <fg...@nuxeo.com> wrote:
> Hi,
>
> I don't think I got comments on this earlier proposal I made:
>
> I don't like this part of the CmisObject API and find it hard to use:
>   <T> T getPropertyValue(String id);
>   <T> List<T> getPropertyMultivalue(String id);
>
> I propose to change it to:
>   <T> T getPropertyValue(String id);
>
> Which would returns a single value for a single-valued property, and a
> List for a multi-valued property. If the client knew which of the two
> methods to call, then it knows if it expects a List or not so it
> doesn't change expressivity.
>
> I haven't yet tried to do the changes in the code but I don't
> anticipate too many difficulties. What do you think?
>
> Florent
>
> --
> Florent Guillaume, Director of R&D, Nuxeo
> Open Source, Java EE based, Enterprise Content Management (ECM)
> http://www.nuxeo.com   http://www.nuxeo.org   +33 1 40 33 79 87
>



-- 
Florent Guillaume, Director of R&D, Nuxeo
Open Source, Java EE based, Enterprise Content Management (ECM)
http://www.nuxeo.com   http://www.nuxeo.org   +33 1 40 33 79 87

Re: getPropertyMultivalue -> getPropertyValue

Posted by Florent Guillaume <fg...@nuxeo.com>.
On Thu, Oct 7, 2010 at 8:58 PM, Chris Hubick <ch...@hubick.com> wrote:
> On Thu, Oct 7, 2010 at 9:20 AM, Florent Guillaume <fg...@nuxeo.com> wrote:
>> I don't think I got comments on this earlier proposal I made:
>>
>> I don't like this part of the CmisObject API and find it hard to use:
>>   <T> T getPropertyValue(String id);
>>   <T> List<T> getPropertyMultivalue(String id);
>>
>> I propose to change it to:
>>   <T> T getPropertyValue(String id);
>>
>> Which would returns a single value for a single-valued property, and a
>> List for a multi-valued property. If the client knew which of the two
>> methods to call, then it knows if it expects a List or not so it
>> doesn't change expressivity.
>
> Forcing all code reading multi-valued properties to cast to List<T>?  -1.

There's no casting involved. That's the point of having a generic free
type variable <T> for the return value in the signature (<T> is a free
variable because there's no <T> in the class definition). The previous
definitions had the same kind of signature btw.

Florent

-- 
Florent Guillaume, Director of R&D, Nuxeo
Open Source, Java EE based, Enterprise Content Management (ECM)
http://www.nuxeo.com   http://www.nuxeo.org   +33 1 40 33 79 87

Re: getPropertyMultivalue -> getPropertyValue

Posted by Chris Hubick <ch...@hubick.com>.
On Thu, Oct 7, 2010 at 9:20 AM, Florent Guillaume <fg...@nuxeo.com> wrote:
> I don't think I got comments on this earlier proposal I made:
>
> I don't like this part of the CmisObject API and find it hard to use:
>   <T> T getPropertyValue(String id);
>   <T> List<T> getPropertyMultivalue(String id);
>
> I propose to change it to:
>   <T> T getPropertyValue(String id);
>
> Which would returns a single value for a single-valued property, and a
> List for a multi-valued property. If the client knew which of the two
> methods to call, then it knows if it expects a List or not so it
> doesn't change expressivity.

Forcing all code reading multi-valued properties to cast to List<T>?  -1.

-- 
Chris Hubick
mailto:chris@hubick.com
http://www.hubick.com/chris/