Hi all
How can I declare something like this in a module so it can be injected?
I have some mapbinders in different modules, and don't like to have lots of
semi-empty interfaces spreaded, so I've created a generic interface:
public interface IFactory<T extends IBuilder<T>> {
public T create(String type);
}
The objects in the mapbinder are expensive to build so I delay it's full
construction helping me with some builder:
public interface IBuilder<T extends IBuilder<T>> {
public T build() throws Exception;
}
The "final" interfaces are like this:
public interface IDataProvider extends IBuilder<IDataProvider> {
public void process(ISigner signer) throws Exception;
}
public interface ISigner extends IBuilder<ISigner> {
public byte[] sign(InputStream inStream) throws Exception;
}
There“s about five "final" interfaces, each one with 3-5 different
implementations.
Prior to this idea I was using five IBuilder interfaces. five IFactory
interfaces and binding them in his own modules, but I think it can be done
better, but I can't see how to inject generic types. I've readed about
TypeLiteral but I can't find a clear example, easy to understand.
Thanks
--
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=.