Exemplo n.º 1
0
  /**
   * Returns the value of a contact with the specific field
   *
   * @param userId The id of the user
   * @param field The field for which data should be returned
   * @return The list of values for the given field
   */
  public <T, R> List<T> getContactField(int userId, ProfileField<T, R> field) {
    List<R> values =
        getResourceFactory()
            .getApiResource("/contact/" + userId + "/" + field.getName())
            .get(new GenericType<List<R>>() {});

    List<T> formatted = new ArrayList<T>();
    for (R value : values) {
      formatted.add(field.parse(value));
    }

    return formatted;
  }