Bill Burke wrote:
>
> On 7/7/11 11:00 AM, Sergey Beryozkin wrote:
>> Sergey Beryozkin wrote:
>>> Hi Santiago
>>>
>>> Santiago Pericas-Geertsen wrote:
>>>> Sergey,
>>>>
>>>> I'm not convinced this is any simpler from the point of the view of
>>>> the application developer. If the common case is to configure a Link
>>>> with parameters, etc. (see Bill's e-mail) then your API is actually
>>>> less friendly.
>>>> Consider the following case which works with the current API:
>>>>
>>>> Link customersUri =
>>>> client.link("http://jaxrs.examples.org/jaxrsApplication/customers").path("{id}");
>>>>
>>>> Customer customer123 = customersUri.get().pathParam("id",
>>>> 123).queryParam("country", "US").invoke(Customer.class);
>>>> Customer customer321 = customersUri.get().pathParam("id",
>>>> 321).invoke(Customer.class);
>>>>
>>> IMHO
>>>
>>> customersUri.get().pathParam("id", 321).invoke(Customer.class);
>>>
>>> needs to be avoided -
>>>
>>> I'm proposing
>>>
>>> client.link("http://jaxrs.examples.org/jaxrsApplication/customers/{id}").pathParam("id",
>>> 123).get();
>>>
>>> Works too.
>>>
>>> Link link =
>>> client.link("http://jaxrs.examples.org/jaxrsApplication/customers/{id}");
>>>
>>> link.pathParam("id", 123).get();
>>> link.pathParam("id", 124).get();
>>>
>>> works as well.
>>>
>>> If we can converge on Bill's proposal then we will get
>>>
>>> Invocation inv =
>>> client.request("http://jaxrs.examples.org/jaxrsApplication/customers/{id}");
>>>
>>>
>>> inv.pathParam("id", 123).get();
>>> inv.pathParam("id", 124).get();
>>>
>>> etc.
>>>
>>> Effectively all I want to do is to turn Link into a URI+metadata
>>> holder only
>> And then we will do
>>
>> Invocation inv = client.getRequest(myLink);
>>
>> (inv is fully initialized with queries, etc, thus thread-safe)
>>
>> as opposed to
>>
>> link.get(), etc
>>
>
> I don't get what your proposal buys us over the current/original one.
> What is the benefit? I don't see it.
>
> client.request(..).pathParam(...).get();
>
> is the same amount of typing as:
>
> client.link(...).pathParam().get();
>
I'm wondering if I'm just unable to convey the message I'm trying to
convey, may be..
I'm fine with
client.request(..).pathParam(...).get();
I don't want to see
client.link(..).get().pathParam(...).invoke();
because it is just not cool at all.
And I'd like to have
client.request(myLink).pathParam(...).get();
Sergey
--
Sergey Beryozkin
http://sberyozkin.blogspot.com
Talend - http://www.talend.com