In my personal use of Chain, I am using it as <String, Object>. So
typing as Context<K, V> is good. Though, do we need type T? Shouldn't
retrieve(K) just return V?

On Fri, Sep 9, 2011 at 2:21 PM, Simone Tripodi <simonetrip...@apache.org> wrote:
> here I am!
> sorry I'm late but just terminated to have dinner :P
> I think that specifying the <extending Object> can be omitted, and
> Paul's suggestion is the way to go, the code is more readable.
>
> The last added method can be improved, putting the K as argument
> instead of String and <T extends V> as a strict check for output
> argument:
>
> public interface Context<K, V>
>    extends Map<K, V>
> {
>
>    <T extends V> T retrieve(K key);
>
> }
>
> what I think is not so nice to have, is the Command, Filter, Chain,
> ..., notation that, getting Context as argument in their methods,
> would require generics...
>
> Lets' think about it, thanks for sharing your thoughts!!!
> All the best,
> Simo
>
> http://people.apache.org/~simonetripodi/
> http://www.99soft.org/
>
>
>
> On Fri, Sep 9, 2011 at 8:56 PM, Elijah Zupancic <eli...@zupancic.name> wrote:
>> Paul,
>>
>> You may be right. Which one is more idiomatic?
>>
>> Thanks,
>> -Elijah
>>
>> On Fri, Sep 9, 2011 at 11:51 AM, Paul Benedict <pbened...@apache.org> wrote:
>>> On Fri, Sep 9, 2011 at 1:47 PM, Elijah Zupancic <eli...@zupancic.name> 
>>> wrote:
>>>> Thanks for your comments Nail.
>>>>
>>>> I think that I've come around to see your point after sleeping on it.
>>>> What do you think about this:
>>>>
>>>> Context.java - would be defined as so:
>>>>
>>>> public interface Context<K extends Object, V extends Object> extends 
>>>> Map<K, V>
>>>
>>> Isn't that identical to?
>>> public interface Context<K, V> extends Map<K, V>
>>>
>>>> Then ContextBase.java would be defined like so:
>>>>
>>>> public class ContextBase extends ConcurrentHashMap<String, Object>
>>>>                implements Context<String, Object> {
>>>
>>> Paul
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
>>> For additional commands, e-mail: dev-h...@commons.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
>> For additional commands, e-mail: dev-h...@commons.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
> For additional commands, e-mail: dev-h...@commons.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org

Reply via email to