Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    AdvancedCriteria with DefaultOperator

    Hi,

    why is this not working:
    Code:
    Criterion c1 = new SimpleCriterion("f_lastname", DefaultOperators.Equals, 'A');
    Criterion c2 = new SimpleCriterion("f_lastname", DefaultOperators.Equals, 'B');
    
    AdvancedCriteria ac = new AdvancedCriteria(DefaultOperators.Or, c1, c2);
    but this is?
    Code:
    Criterion c1 = new SimpleCriterion("f_lastname", DefaultOperators.Equals, 'A');
    Criterion c2 = new SimpleCriterion("f_lastname", DefaultOperators.Equals, 'B');
    
    AdvancedCriteria ac = new AdvancedCriteria("or" c1, c2);
    I think a constructor is missing. Using smartgwt 6.1p power 2018-03-22
    Last edited by edulid; 26 Mar 2018, 00:56.

    #2
    In Java such additional constructor cannot be added, cause it would conflict with existing constructors.

    Comment


      #3
      Hi Isomorphic

      now you have these constructors:

      AdvancedCriteria(Operator operator, Criterion[] criteria)
      AdvancedCriteria(String operator, Criterion ... criteria)

      If you change the first one to be analogous as the second one, thus change it to:
      AdvancedCriteria(Operator operator, Criterion ... criteria)

      then:
      1. This code will work:
      AdvancedCriteria ac = new AdvancedCriteria(DefaultOperators.Or, c1, c2);
      2. Code using
      AdvancedCriteria ac = new AdvancedCriteria(DefaultOperators.Or, criterions);
      with a Criterion[] criterions will still work, since it is an array.
      3. Both constructors would be consistent.

      I think these are good reasons. Or am I overseeing something ?
      Last edited by edulid; 4 Apr 2018, 23:55.

      Comment


        #4
        You're right, this is valid and useful change. It will be available in nightly builds since Apr 6 (today).

        Comment

        Working...
        X