Tapestry 5
  1. Tapestry 5
  2. TAP5-1495

Tapestry's property expression language should support map creation

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 5.3
    • Fix Version/s: 5.3
    • Component/s: tapestry-core
    • Labels:
      None

      Description

      Currently, tapestry expressions support property access, method calls, null checks (?.), and quick list creation (['a',b,...]), but there is no support for map creation.
      It would be nice to be able to write:

      {a=>b,c=>d}

      to quickly and easily create maps.

        Activity

        Hide
        Robert Zeigler added a comment -

        Final map syntax:

        {a: b, c: d}
        Show
        Robert Zeigler added a comment - Final map syntax: {a: b, c: d}
        Hide
        Hudson added a comment -

        Integrated in tapestry-trunk-freestyle #338 (See https://builds.apache.org/hudson/job/tapestry-trunk-freestyle/338/)
        TAP5-1495: Tapestry's property expression language should support map creation
        Fix minor typo in plastic documentation
        Clarify "parameters" parameter documentation in AbstractLink.

        Show
        Hudson added a comment - Integrated in tapestry-trunk-freestyle #338 (See https://builds.apache.org/hudson/job/tapestry-trunk-freestyle/338/ ) TAP5-1495 : Tapestry's property expression language should support map creation Fix minor typo in plastic documentation Clarify "parameters" parameter documentation in AbstractLink.
        Hide
        Robert Zeigler added a comment -

        Fair enough. For the record, I thought of the map support while considering the need to be able pass request parameters to the link components. Map is a natural fit for that, and it then occurred to me that expression support for maps would be useful.

        Show
        Robert Zeigler added a comment - Fair enough. For the record, I thought of the map support while considering the need to be able pass request parameters to the link components. Map is a natural fit for that, and it then occurred to me that expression support for maps would be useful.
        Hide
        Howard M. Lewis Ship added a comment -

        I think Igor's point was that there was a need for arrays, to support more complex page activation contexts, but there's no components currently in Tapestry that require a literal map syntax ... though I have no doubt that once a literal map syntax exists, it will be utilized.

        Show
        Howard M. Lewis Ship added a comment - I think Igor's point was that there was a need for arrays, to support more complex page activation contexts, but there's no components currently in Tapestry that require a literal map syntax ... though I have no doubt that once a literal map syntax exists, it will be utilized.
        Hide
        Robert Zeigler added a comment -

        Igor: By that argument, what's the use case for list/array creation support in the property language? We could have provided a coercion from String to List...

        Howard: Yeah, the syntax was more just to get the idea down. Json-like syntax might work nicely.

        Show
        Robert Zeigler added a comment - Igor: By that argument, what's the use case for list/array creation support in the property language? We could have provided a coercion from String to List... Howard: Yeah, the syntax was more just to get the idea down. Json-like syntax might work nicely.
        Hide
        Howard M. Lewis Ship added a comment -

        That's not the syntax I'd prefer, as it won't work well inside an XML document such as a Tapestry template: Maybe something more like JSON syntax.

        { 'a': b, 'c': d}
        Show
        Howard M. Lewis Ship added a comment - That's not the syntax I'd prefer, as it won't work well inside an XML document such as a Tapestry template: Maybe something more like JSON syntax. { 'a': b, 'c': d}
        Hide
        Igor Drobiazko added a comment -

        What is actually the use case?

        Currently there is a coercion String->SelectModel:

        <t:select value="paymentType" model="literal:cc=Credit Card,bt=Bank Transfer, ca=Cash,pp=PayPal"/>

        Maybe we could provide same for String -> Map

        Show
        Igor Drobiazko added a comment - What is actually the use case? Currently there is a coercion String->SelectModel: <t:select value="paymentType" model="literal:cc=Credit Card,bt=Bank Transfer, ca=Cash,pp=PayPal"/> Maybe we could provide same for String -> Map

          People

          • Assignee:
            Robert Zeigler
            Reporter:
            Robert Zeigler
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development