Exemplo n.º 1
0
  private <T, F, R> List<T> getContactsCommon(
      WebResource resource,
      ProfileField<F, R> key,
      F value,
      Integer limit,
      Integer offset,
      final ProfileType<T> type,
      ContactOrder order,
      ContactType contactType) {
    if (key != null && value != null) {
      resource =
          resource
              .queryParam("key", key.getName().toLowerCase())
              .queryParam("value", key.format(value).toString());
    }
    if (limit != null) {
      resource = resource.queryParam("limit", limit.toString());
    }
    if (offset != null) {
      resource = resource.queryParam("offset", offset.toString());
    }
    resource = resource.queryParam("type", type.getName());
    if (order != null) {
      resource = resource.queryParam("order", order.name().toLowerCase());
    }
    if (contactType != null) {
      resource = resource.queryParam("contact_type", contactType.name().toLowerCase());
    }

    return resource.get(getGenericType(type));
  }