Type mismatch: cannot convert from new IConverter<Integer>(){} to IConverter<Z>

i can hard cast to IConverter<Z> myself, but then there is very little
point to having it generified

-igor


On Tue, Apr 15, 2008 at 11:59 AM, Bruno Borges <[EMAIL PROTECTED]> wrote:
> What is the compile error message?
>
>  On Tue, Apr 15, 2008 at 3:10 PM, Igor Vaynberg <[EMAIL PROTECTED]>
>
>
> wrote:
>
>  > maybe just IConverter<?> getConverter(Class<?> cl)
>  >
>  > -igor
>  >
>  >
>  > On Tue, Apr 15, 2008 at 11:05 AM, Igor Vaynberg <[EMAIL PROTECTED]>
>  > wrote:
>  > > example below doesnt compile, so im not exactly sure how to override
>  > >  generified getconverter() properly ... do we need to change our
>  > >  generics decl somehow?
>  > >
>  > >  -igor
>  > >
>  > >      @Override
>  > >         public <Z> IConverter<Z> getConverter(Class<Z> type)
>  > >         {
>  > >                 if (Integer.class.isAssignableFrom(type))
>  > >                 {
>  > >                         return new IConverter<Integer>()
>  > >                         {
>  > >                                 private static final long
>  > serialVersionUID = 1L;
>  > >
>  > >                                 public Integer convertToObject(String
>  > value, Locale locale)
>  > >                                 {
>  > >                                         return null;
>  > >                                 }
>  > >
>  > >                                 public String convertToString(Integer
>  > value, Locale locale)
>  > >                                 {
>  > >                                         return null;
>  > >                                 }
>  > >
>  > >                         };
>  > >                 }
>  > >                 else
>  > >                 {
>  > >                         return super.getConverter(type);
>  > >                 }
>  > >         }
>  > >
>  >
>
>
>
>  --
>  Bruno Borges
>  blog.brunoborges.com.br
>  +55 1185657739
>
>  "The glory of great men should always be
>  measured by the means they have used to
>  acquire it."
>  - Francois de La Rochefoucauld
>

Reply via email to