Tapestry
  1. Tapestry
  2. TAPESTRY-1394

@InitialValue("null") sets property to empty collection not null

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: None
    • Fix Version/s: 4.1.5
    • Component/s: None
    • Labels:
      None

      Description

      This :

      @InitialValue("null")
      public abstract List<BroadcastProviderUrl> getCachedUrls();

      results in cachedUrls being set to an empty list instead of null.

        Activity

        Hide
        Patrick Moore added a comment -

        sounds good ... the new tacos notation sounds like it is what is needed!

        thanks

        Show
        Patrick Moore added a comment - sounds good ... the new tacos notation sounds like it is what is needed! thanks
        Hide
        Andreas Andreou added a comment -

        I believe that the @Cached annotation from tacos is what you can use here.
        https://tacos.svn.sourceforge.net/svnroot/tacos/tacos-4.1/trunk/tacos-annotations/src/java/net/sf/tacos/annotations/Cached.java

        It does transparent caching for method results (during a single requests) and resets values to null

        Show
        Andreas Andreou added a comment - I believe that the @Cached annotation from tacos is what you can use here. https://tacos.svn.sourceforge.net/svnroot/tacos/tacos-4.1/trunk/tacos-annotations/src/java/net/sf/tacos/annotations/Cached.java It does transparent caching for method results (during a single requests) and resets values to null
        Hide
        Jun Tsai added a comment -

        In your case #2,if you don't provide an Initialvalue annotation,the parameter is null when it is put back into the pool.

        Show
        Jun Tsai added a comment - In your case #2,if you don't provide an Initialvalue annotation,the parameter is null when it is put back into the pool.
        Hide
        Patrick Moore added a comment -

        Glad you asked...

        Well @InitialValue really serves 2 purposes:

        1) to set a parameter to an initial value when an instance of the page/component is created.
        2) to reset the parameter to a default value when the instance is put back into the instance pool.

        I need to use @InitialValue for case #2 so that the page doesn't hang on to object graphs that it shouldn't.

        Show
        Patrick Moore added a comment - Glad you asked... Well @InitialValue really serves 2 purposes: 1) to set a parameter to an initial value when an instance of the page/component is created. 2) to reset the parameter to a default value when the instance is put back into the instance pool. I need to use @InitialValue for case #2 so that the page doesn't hang on to object graphs that it shouldn't.
        Hide
        Jesse Kuhnert added a comment -

        Pardon me for asking, but if you want the value to be null why don't you just not provide an InitialValue annotation?

        Show
        Jesse Kuhnert added a comment - Pardon me for asking, but if you want the value to be null why don't you just not provide an InitialValue annotation?

          People

          • Assignee:
            Andreas Andreou
            Reporter:
            Patrick Moore
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development