You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by Gary Gregory <ga...@gmail.com> on 2018/01/10 21:05:20 UTC

Fwd:

From: Gary Gregory <ga...@gmail.com>
Date: Wed, Jan 10, 2018 at 2:03 PM
Subject:
To: HttpComponents Project <de...@hc.apache.org>


Hi All, today we have:

public class DefaultHttpClientIODispatch
                    extends AbstractIODispatch<DefaultNHttpClientConnection>

I would like to use generics in order to type the handler like this:

public class DefaultHttpClientIODispatch<H extends NHttpClientEventHandler>
                    extends AbstractIODispatch<DefaultNHttpClientConnection>

This allows call sites to call getHandler() and get the exact type that was
passed in on construction instead of getting back the interface and going a
type-cast (if you need access to the actual class like I do.)

Same for DefaultHttpServerIODispatch.

I am currently working around not having this feature easily. This is a
"nice-to-have" but not essential.

Thoughts?

Gary

Re: Fwd:

Posted by Gary Gregory <ga...@gmail.com>.
On Thu, Jan 11, 2018 at 1:38 AM, Oleg Kalnichevski <ol...@apache.org> wrote:

> On Wed, 2018-01-10 at 14:05 -0700, Gary Gregory wrote:
> > From: Gary Gregory <ga...@gmail.com>
> > Date: Wed, Jan 10, 2018 at 2:03 PM
> > Subject:
> > To: HttpComponents Project <de...@hc.apache.org>
> >
> >
> > Hi All, today we have:
> >
> > public class DefaultHttpClientIODispatch
> >                     extends
> > AbstractIODispatch<DefaultNHttpClientConnection>
> >
> > I would like to use generics in order to type the handler like this:
> >
> > public class DefaultHttpClientIODispatch<H extends
> > NHttpClientEventHandler>
> >                     extends
> > AbstractIODispatch<DefaultNHttpClientConnection>
> >
> > This allows call sites to call getHandler() and get the exact type
> > that was
> > passed in on construction instead of getting back the interface and
> > going a
> > type-cast (if you need access to the actual class like I do.)
> >
> > Same for DefaultHttpServerIODispatch.
> >
> > I am currently working around not having this feature easily. This is
> > a
> > "nice-to-have" but not essential.
> >
> > Thoughts?
> >
> > Gary
>
> Works for me.
>

Done.

Thanks Oleg,
Gary


> Oleg
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
> For additional commands, e-mail: dev-help@hc.apache.org
>
>

Re: Fwd:

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Wed, 2018-01-10 at 14:05 -0700, Gary Gregory wrote:
> From: Gary Gregory <ga...@gmail.com>
> Date: Wed, Jan 10, 2018 at 2:03 PM
> Subject:
> To: HttpComponents Project <de...@hc.apache.org>
> 
> 
> Hi All, today we have:
> 
> public class DefaultHttpClientIODispatch
>                     extends
> AbstractIODispatch<DefaultNHttpClientConnection>
> 
> I would like to use generics in order to type the handler like this:
> 
> public class DefaultHttpClientIODispatch<H extends
> NHttpClientEventHandler>
>                     extends
> AbstractIODispatch<DefaultNHttpClientConnection>
> 
> This allows call sites to call getHandler() and get the exact type
> that was
> passed in on construction instead of getting back the interface and
> going a
> type-cast (if you need access to the actual class like I do.)
> 
> Same for DefaultHttpServerIODispatch.
> 
> I am currently working around not having this feature easily. This is
> a
> "nice-to-have" but not essential.
> 
> Thoughts?
> 
> Gary

Works for me.

Oleg

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org