On Mar 12, 9:59 pm, Bob Lee <[email protected]> wrote:
> Here's another approach that makes ArtifactLocator immutable:
>
> @Provides @Singleton ArtifactLocator provideArtifactLocator(
> ArtifactLocator.Builder builder, RaceTemplateFinder a,
> EventTemplateFinder b, ClasspathTemplateFinder c) {
> return builder.add(a).add(b).add(c).build();
> }
I've used a provider method like this. It eliminates the need for a
builder class. The array of dependencies is constructor injected to
the class which uses it.
@Provides
SerializationListener[]
serializationListeners(CheckInnerClassSerialized listener1,
CheckDirectlyReferredEntitySerialized listener2,
InjectObjectsOnDeserialization listener3,
EntityIdSerializationListener listener4) {
return new SerializationListener[]{listener1, listener2,
listener3, listener4};
}
--
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.