Tapestry 5
  1. Tapestry 5
  2. TAP5-1112

Handle array types in property expressions

    Details

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

      Description

      Passing an array as an argument currently does not work. I saw a TODO in PropertyConduitSourceImpl.java regarding this and made a patch.

      public class Test
      {
      public String[] getArray()

      { return new String[4]; }

      public String useArray(String[] array)

      { return "test"; }

      }

      <html
      xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd"
      xmlns="tapestry:parameter">

      <p>$

      {useArray(array)}

      </p>

      </html>

      diff -r tapestry5/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/PropertyConduitSourceImpl.java tapestry5-mod/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/PropertyConduitSourceImpl.java
      914,915c914,920
      < // TODO: handle arrays types
      < return InternalUtils.lastTerm(type.getName());

      > if (type.isArray())
      >

      { > Class<?> baseType = type.getComponentType(); > while (baseType.isArray()) baseType = baseType.getComponentType(); > return InternalUtils.lastTerm(baseType.getName()); > }

      > else return InternalUtils.lastTerm(type.getName());

        Activity

        Hide
        Igor Drobiazko added a comment -

        Thanks for the patch. Unfortunately the patch doesn't contain any test. I extended the patch by tests.

        Show
        Igor Drobiazko added a comment - Thanks for the patch. Unfortunately the patch doesn't contain any test. I extended the patch by tests.

          People

          • Assignee:
            Igor Drobiazko
            Reporter:
            Adam
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development