Details

    • Type: Improvement Improvement
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: core, extras
    • Labels:
      None

      Description

      In CLK-633, the API was upgraded to use type safe collections. The remaining internal parts of Click should also be upgraded.

        Activity

        Hide
        Bob Schellink added a comment -

        I'm not sure the cost outweighs the benefit. The OptionOrGroup feels awkward to me especially the OptionGroupi#getValue method. What do others think?

        Show
        Bob Schellink added a comment - I'm not sure the cost outweighs the benefit. The OptionOrGroup feels awkward to me especially the OptionGroupi#getValue method. What do others think?
        Hide
        Finn Bock added a comment -

        Making the Select control typesafe requires some non trivial changes. In the typesafe-select.patch I have shown my take on it.

        The main change is a common interface for both Option and OptionGroup (unimaginative called OptionOrGroup).

        A typesafe use of by the DataProvider becomes:

        select.setDataProvider(new DataProvider<OptionOrGroup>() {
        public Iterable<OptionOrGroup> getData()

        { List<OptionOrGroup> list = new ArrayList<OptionOrGroup>(); list.add(...); return list; }

        });

        Show
        Finn Bock added a comment - Making the Select control typesafe requires some non trivial changes. In the typesafe-select.patch I have shown my take on it. The main change is a common interface for both Option and OptionGroup (unimaginative called OptionOrGroup). A typesafe use of by the DataProvider becomes: select.setDataProvider(new DataProvider<OptionOrGroup>() { public Iterable<OptionOrGroup> getData() { List<OptionOrGroup> list = new ArrayList<OptionOrGroup>(); list.add(...); return list; } });
        Hide
        Adrian A. added a comment -

        > I also suggest we leave WebappResourceLoader as-is since it was copied from Velocity and will complicate tracking changes.
        +1.
        Unless we need our own customized version, it's simpler to track changes if it's kept unmodified.

        > Also what is the difference between Map<String, Object> and Map<String, ?>
        > CayenneTemplate uses this notation so I'm curious what are the advantages of that?
        The wildcard '?' is of "any type" so it's more than just 'Object'.
        e.g. a better explanation here:
        http://tutorials.jenkov.com/java-generics/wildcards.html

        Show
        Adrian A. added a comment - > I also suggest we leave WebappResourceLoader as-is since it was copied from Velocity and will complicate tracking changes. +1. Unless we need our own customized version, it's simpler to track changes if it's kept unmodified. > Also what is the difference between Map<String, Object> and Map<String, ?> > CayenneTemplate uses this notation so I'm curious what are the advantages of that? The wildcard '?' is of "any type" so it's more than just 'Object'. e.g. a better explanation here: http://tutorials.jenkov.com/java-generics/wildcards.html
        Hide
        Bob Schellink added a comment -

        I've noticed some of the collection generics are using Map<String, String> where it was Map before. In essence that means moving from Map<Object, Object> to Map<String, String> which will break backward compatibility. It also makes programming against it more cumbersome, for example if you have a Map where the values are Integers, one will have to convert them to Strings before continuing. We could use toString on these values internally.

        Some examples are:

        RadioGroup.java:
        public void addAll(Map<String, String> options) {

        public static void autoPostRedirect(HttpServletRequest request, HttpServletResponse response, String target, Map<String, String> params, boolean compress) {

        I also suggest we leave WebappResourceLoader as-is since it was copied from Velocity and will complicate tracking changes.

        Also what is the difference between Map<String, Object> and Map<String, ?>

        CayenneTemplate uses this notation so I'm curious what are the advantages of that?

        Show
        Bob Schellink added a comment - I've noticed some of the collection generics are using Map<String, String> where it was Map before. In essence that means moving from Map<Object, Object> to Map<String, String> which will break backward compatibility. It also makes programming against it more cumbersome, for example if you have a Map where the values are Integers, one will have to convert them to Strings before continuing. We could use toString on these values internally. Some examples are: RadioGroup.java: public void addAll(Map<String, String> options) { public static void autoPostRedirect(HttpServletRequest request, HttpServletResponse response, String target, Map<String, String> params, boolean compress) { I also suggest we leave WebappResourceLoader as-is since it was copied from Velocity and will complicate tracking changes. Also what is the difference between Map<String, Object> and Map<String, ?> CayenneTemplate uses this notation so I'm curious what are the advantages of that?

          People

          • Assignee:
            Finn Bock
            Reporter:
            Finn Bock
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:

              Development