Expression chains

From: Cris Daniluk (cris.danilu..laraview.com)
Date: Wed Feb 16 2005 - 16:42:51 EST

  • Next message: Mike Kienenberger: "Re: Expression chains"

    Not sure if I've brought this up here yet or not, but I think it would be
    handy to extend ExpressionFactory to accept parameters like this:

    ExpressionFactory.matchExp(new String[] { "toPainting", "toArtist",
    "artistName" }, "Monet")

    As an alternative to:

    ExpressionFactory.matchExp("toPainting.toArtist.artistName", "Monet");

    The reason for this is that we do not use the literal references to
    relationships, but rather the constants exposed by Cayenne in the
    DataObjects:

    ExpressionFactory.matchExp(MUSEUM.TO_PAINTING_PROPERTY+"."+PAINTING.TO_ARTIS
    T_PROPERTY+"."+ARTIST.ARTIST_NAME_PROPERTY, "Monet");

    It looks a little silly, but it allows us to convert field renamings from
    difficult to find bugs into compile errors. Thus if you rename the
    relationship in Cayenne, you cannot build the project, giving you immediate
    feedback. By chaining them in a String array, it cleans up the horrendous
    syntax above and avoids all the string concats or the need for a
    StringBuffer in the code. I would not mind implementing it, as it would be
    pretty painless. Any thoughts?

    Cris



    This archive was generated by hypermail 2.0.0 : Wed Feb 16 2005 - 16:42:50 EST