Spring Social Facebook
  1. Spring Social Facebook
  2. SOCIALFB-9

Change signature of GraphApi.fetchConnections() to take type of list element instead of type of returned object.

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Complete
    • Affects Version/s: None
    • Fix Version/s: 1.0.0.RC2
    • Component/s: None
    • Labels:
      None

      Description

      As noted by nickspacek in the forum, it's not intuitive for fetchConnections() to accept the type of object to be returned when fetchConnections() will always return a list (or a list wrapper type).

      List<Account> accounts = fb.fetchConnections("me", "accounts", AccountList.class).getList();

      Furthermore, the use of list wrapper types requires that they either be exposed as part of the public API or the user will have to create duplicates of them to be able to use fetchConnections()...neither of which is ideal.

      Instead the list element type should be specified and the details of how it is deserialized handled internally to fetchConnections(). For example, the previous example should look like this:

      List<Account> accounts = fb.fetchConnections("me", "accounts", Account.class);

      This indicates that the the me/accounts endpoint should be fetched and the results returned in a List of Account objects. How the JSON response is deserialized into List<Account> is an internal detail.

        Activity

        Hide
        Craig Walls added a comment -

        Changed GraphApi.fetchConnections() to return List<T> instead of T (a list is always expected from fetchConnections()). Also did away with the list wrapper types--FacebookTemplate now deserializes just enough of the response to get the "data" field and determine the list type, and then hands it back to Jackson to deserialize into a typed list using the annotations on the element type.

        Show
        Craig Walls added a comment - Changed GraphApi.fetchConnections() to return List<T> instead of T (a list is always expected from fetchConnections()). Also did away with the list wrapper types--FacebookTemplate now deserializes just enough of the response to get the "data" field and determine the list type, and then hands it back to Jackson to deserialize into a typed list using the annotations on the element type.

          People

          • Assignee:
            Craig Walls
            Reporter:
            Craig Walls
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: