Uploaded image for project: 'Causeway'
  1. Causeway
  2. CAUSEWAY-1331

If return a google guava collection from an autoComplete or choices, then throws exception due to unsupported classes.

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Resolved
    • 1.11.1
    • 2.0.0-M1
    • Core
    • None

    Description

      For example, this seemingly innocuous code:

          public List<SimpleObject> autoComplete(@MinLength(2) String search) {
              return
                          FluentIterable.from(listAll())
                          .filter(new Predicate<SimpleObject>() {
                              @Override public boolean apply(@Nullable final SimpleObject object) {
                                  return object.getName().contains(search);
                              }
                          })
                          .toList();
          }
      

      will fail. to make it work, the developer needs to copy to an ArrayList, eg:

          public List<SimpleObject> autoComplete(@MinLength(2) String search) {
              return
                      Lists.newArrayList(
                          FluentIterable.from(listAll())
                          .filter(new Predicate<SimpleObject>() {
                              @Override public boolean apply(@Nullable final SimpleObject object) {
                                  return object.getName().contains(search);
                              }
                          })
                          .toList()
                      );
          }
      

      One possible solution is for the framework to do this automatically, for List, Set, Collection.

      Attachments

        Issue Links

          Activity

            People

              hobrom Andi Huber
              danhaywood Daniel Keir Haywood
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: