This was brought up before -- I think a javadoc or wiki needed editing (because it showed an example of using it with a class, not a TypeLiteral), but forget where the incorrect example was.
Sam On Wed, Jan 20, 2010 at 4:53 PM, Dhanji R. Prasanna <[email protected]> wrote: > You're matching a class but the method wants a type literal. More > importantly Guice only supports type conversion for constants. > > Dhanji. > 2010/1/21 Willi Schönborn <[email protected]> >> >> Hi there, >> >> i tried to register a TypeConverter for Files (java.io.File): >> >> binder().convertToTypes(Matchers.subclassesOf(File.class), new >> TypeConverter() { >> @Override >> public File convert(String fileName, TypeLiteral<?> literal) { >> return new File(fileName); >> } >> }); >> >> And received the following compiler error? >> >> The method convertToTypes(Matcher<? super TypeLiteral<?>>, TypeConverter) >> in the type Binder is not applicable for the arguments (Matcher<Class>, new >> TypeConverter(){}) >> >> Any suggestions how to convince javac to eat it? >> >> -- >> You received this message because you are subscribed to the Google Groups >> "google-guice" group. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]. >> For more options, visit this group at >> http://groups.google.com/group/google-guice?hl=en. >> >> >> > > > -- > You received this message because you are subscribed to the Google Groups > "google-guice" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/google-guice?hl=en. > >
-- You received this message because you are subscribed to the Google Groups "google-guice" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-guice?hl=en.
