Re: Expression chains

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Mon Feb 21 2005 - 21:56:58 EST

  • Next message: Mike Kienenberger: "Re: cayenne build-tests.xml,1.26,1.27"

    I tend to agree with Cris's point on that. In fact I was thinking for
    some time to add similar API for Cayenne "template" (i.e.
    parameterized) objects such as queries and expressions. E.g. instead of
    this:

    Map map = new HashMap();
    map.put("a", "1");
    map.put("b", "2");
    map.put("c", "3");
    map.put("d", "4");
    context.performQuery("MyQuery", map);

    one should be able to do this:

    String[] keys = new String[] { "a", "b", "c", "d"};
    Object[] objects = new Object[] { "1", "2", "3", "4"};
    context.performQuery("MyQuery", keys, objects);

    I personally always prefer a second form - seems much cleaner and
    easier to read.

    Andrus

    On Feb 16, 2005, at 5:17 PM, Cris Daniluk wrote:
    >> import org.apache.commons.lang.StringUtils; // cayenne dependency
    >>
    >> ExpressionFactory.matchExp(StringUtils.join(String[] {
    >> MUSEUM.TO_PAINTING_PROPERTY, PAINTING.TO_ARTIST_PROPERTY,
    >> ARTIST.ARTIST_NAME_PROPERTY }, '.'), "Monet");
    >>
    >>
    >
    > We do this now. Just seems syntactically unpure.
    >
    > Cayenne keeps the burden of string literals away from you pretty much
    > everywhere but right here. Would be nice to make the concept
    > transparent to
    > the users I think.
    >
    >



    This archive was generated by hypermail 2.0.0 : Mon Feb 21 2005 - 21:57:02 EST