db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Fischer <Fisc...@seitenbau.net>
Subject Re: cvs commit: db-torque/src/java/org/apache/torque/util Criteria.java
Date Mon, 13 Dec 2004 19:17:46 GMT




I looked into the "Join everything" Patch which Daniel submitted this
weekend, and tried to prove that this functionality could also be achieved
by autogenerated methods in the peer classes. To do this, I needed to know
which joins are stored inside the criteria, so I actually needed this
method to be public. By the way, the join object is already a bean and not
an arrayList(3).

Ok, I would agree that on first thought, package visibility would be
appropriate.  But then, all the getHaving, getGroupBy... methods are
public, which provide a List of strings. Is exposing a list of Strings
better than exposing a list of custom beans ? In my opinion it is worse to
expose the String list, because one cannot add functionality (new methods,
fields) to the String, whereas one can do this on custom join Beans. So one
rather should make the getHaving().. methods package visible.
However, now as I have written this, I realize this is an argument in the
line of "I alredy made this error thrice, let's do it again"

To come to a conclusion, situations might occur where one wants to read the
contents of a criteria object outside of its package (especuially in the
peer classes)), so I am in favour of letting the method public. It will
ALWAYS stay at collection of custom Join Beans, even if the Join object
itself changes. Even if you return to the old version, kick the join
operator aot of the bean and you are there !
But modifications of the list should be certainly prohibited, so the List
should be return with an Collections.unmodifiableList wrapper.

Are you content with this ?

   Thomas


"Henning P. Schmiedehausen" <hps@intermeta.de> schrieb am 13.12.2004
19:48:46:

> tfischer@apache.org writes:
>
> >tfischer    2004/12/13 09:35:28
>
> >  Modified:    src/java/org/apache/torque/util Tag: TORQUE_3_1_BRANCH
> >                        Criteria.java
> >  Log:
> >  Changed getJoins() to public access
> >  No reason why it should not be public (all the other getters are)
>
> I didn't want to expose the Join objects outside the util package to
> the end user. If you open up this method, you lock in the object
> signature (which ATM is an Arraylist(3) and should be replaced with a
> thinner Join bean) because you expose the contents to the
> public. Changing this would later be a nasty surprise to the users.
>
> Do you actually need this or is this a "well, this seems to be a good
> idea" patch?
>
>    Regards
>       Henning
>
>
> >
> >  Revision  Changes    Path
> >  No                   revision
> >  No                   revision
> >  1.42.2.6  +2 -2      db-
> torque/src/java/org/apache/torque/util/Criteria.java
> >
> >  Index: Criteria.java
> >  ===================================================================
> >  RCS file: /home/cvs/db-
> torque/src/java/org/apache/torque/util/Criteria.java,v
> >  retrieving revision 1.42.2.5
> >  retrieving revision 1.42.2.6
> >  diff -u -r1.42.2.5 -r1.42.2.6
> >  --- Criteria.java   1 Dec 2004 15:03:39 -0000   1.42.2.5
> >  +++ Criteria.java   13 Dec 2004 17:35:28 -0000   1.42.2.6
> >  @@ -1346,7 +1346,7 @@
> >        * @return a List which contains objects of type Join,
> >        *         or null if the criteria dies not contains any joins
> >        */
> >  -    List getJoins()
> >  +    public List getJoins()
> >       {
> >           return joins;
> >       }
> >
> >
> >
>
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
> >For additional commands, e-mail: torque-dev-help@db.apache.org
>
> --
> Dipl.-Inf. (Univ.) Henning P. Schmiedehausen          INTERMETA GmbH
> hps@intermeta.de        +49 9131 50 654 0   http://www.intermeta.de/
>
> RedHat Certified Engineer -- Jakarta Turbine Development  -- hero for
hire
>    Linux, Java, perl, Solaris -- Consulting, Training, Development
>
> What is more important to you...
>    [ ] Product Security
> or [ ] Quality of Sales and Marketing Support
>               -- actual question from a Microsoft customer survey
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-dev-help@db.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org


Mime
View raw message