Uploaded image for project: 'JDO'
  1. JDO
  2. JDO-737

Change Query API to be "fluent"

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • JDO 3.2
    • api, specification, tck
    • None

    Description

      Further to JDO-736 it would be nice to redesign the Query class to have the setter methods as FLUENT. I see two ways of achieving this

      Option1
      Query q = pm.newQuery(Person.class).filter("firstName.startsWith('F')").orderBy("firstName");

      So we add a subset of the setters as methods without "set" so as to align further with the typesafe variant in JDO-652. The existing setXXX methods can be deprecated.

      Option2
      Query q = pm.newQuery(Person.class).setFilter("firstName.startsWith('F')").setOrdering("firstName");

      So we change the return type of (some of) the existing setters. Existing JDO code will need to be recompiled due to the return type change.

      What is decided here needs to coordinate with JDO-652 so that, for example, if JDO-652 comes up with an API like (as currently)

      query.filter(cand.value.lt.40).orderBy(cand.name.asc())

      then this issue matches the API method names, so using the String-based API for the same resultant query the user would do
      query.filter("this.value < 40").orderBy("this.name ASC");

      Attachments

        1. JDO-737.patch
          2 kB
          Andy Jefferson

        Activity

          People

            mbo Michael Bouschen
            andyj Andy Jefferson
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: