Re: Computed Attributes

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Fri Feb 17 2006 - 11:27:33 EST

  • Next message: Bruce Alspaugh: "Re: Computed Attributes"

    I guess I am more positive about the idea of transient attributes now
    than I was before. Maybe someday ;-)

    Andrus

    On Feb 17, 2006, at 2:42 AM, Jürgen Saar wrote:

    > Yes ist does cover most unusually need,
    > but there a 2 additional aspects:
    >
    > -- 1 --
    > For generation tasks, like velocity, it would be helpful
    > if they can be controlled by repository
    >
    > -- 2 --
    > In the team it brings more transparency for
    > the Datastructure
    >
    >
    > And I think it should be easy to ignore the
    > transient attributes on all db activities
    > within the cayenne engine.
    >
    >
    >
    > 2006/2/16, Joshua Pyle <joshua.t.pyl..mail.com>
    >>
    >> Maybe I'm over simplifying but if I need an attribute on a cayenne
    >> object I just create the appropriate getter and perform whatever
    >> calcs
    >> needed in that getter. In the example I provide I'm just
    >> formatting a
    >> date but I could also run another query loop through the results and
    >> spit out a sum. I could even execute a SQLTemplate query.
    >>
    >> public class User extends _User{
    >> public String getEntryDateString{
    >> Date toFormat = this.getEntryDate();
    >> if( toFormat == null ){
    >> return "";
    >> }else{
    >> return Util.SIMPLE_DATE.format( toFormat );
    >> }
    >> }
    >>
    >> public Double getComplexThingy{
    >> Double toReturn = new Double(0.0);
    >> // TODO loop through a List of object and perform a
    >> complex calculation
    >> return toReturn;
    >> }
    >> }
    >>
    >> I have yet to find a situation where this does not cover even my most
    >> unusually needs.
    >>
    >> Joshua T. Pyle
    >>
    >
    > ______________________________________________________________________
    > ____
    > Erweitern Sie FreeMail zu einem noch leistungsstarkeren E-Mail-
    > Postfach!
    > Mehr Infos unter http://freemail.web.de/home/landingpad/?mc=021131
    >
    >



    This archive was generated by hypermail 2.0.0 : Fri Feb 17 2006 - 11:27:37 EST