Chemistry
  1. Chemistry
  2. CMIS-259

Simplify value vs multi-value management in high-level API

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 0.1.0-incubating
    • Fix Version/s: 0.2.0-incubating
    • Component/s: None
    • Labels:
      None

      Description

      This part of the high-level API is hard to use:
         <T> T getPropertyValue(String id);
         <T> List<T> getPropertyMultivalue(String id);
      Because the caller has two call two different methods depending on the type when in the end he just wants an object.

      Same problem for setters:
      <T> void setProperty(String id, T value);
      <T> void setPropertyMultivalue(String id, List<T> value);

        Activity

        Hide
        Florent Guillaume added a comment -

        Replace the two getters with:
           <T> T getPropertyValue(String id);
        Which returns a single value for a single-valued property, and a list for a multi-valued property.
        Replace the two setters with:
        <T> void setProperty(String id, Object value);
        The <T> being used internally in the implementation to help casting.

        Also add to Property<T> a method:
        <U> U getValue();
        That would do the same (we cannot use <T> here).

        The internal ObjectFactory.createPropertyMultivalue method is also simplified along similar lines. The PersistentPropertyImpl constructor is changed also to always take a list.

        Show
        Florent Guillaume added a comment - Replace the two getters with:    <T> T getPropertyValue(String id); Which returns a single value for a single-valued property, and a list for a multi-valued property. Replace the two setters with: <T> void setProperty(String id, Object value); The <T> being used internally in the implementation to help casting. Also add to Property<T> a method: <U> U getValue(); That would do the same (we cannot use <T> here). The internal ObjectFactory.createPropertyMultivalue method is also simplified along similar lines. The PersistentPropertyImpl constructor is changed also to always take a list.
        Show
        Florent Guillaume added a comment - Done in http://svn.apache.org/viewcvs?view=rev&rev=1006347

          People

          • Assignee:
            Florent Guillaume
            Reporter:
            Florent Guillaume
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development