> +import org.jclouds.rest.MapBinder;
> +import org.jclouds.rest.binders.BindToJsonPayload;
> +
> +import com.google.common.collect.ImmutableMap;
> +import com.google.common.collect.Lists;
> +import com.google.common.collect.Maps;
> +import com.google.inject.Inject;
> +
> +/**
> + * Decouple building the json object from the domain objects structure by
> using the binder
> + * @author Zack Shoylev
> + */
> +public class BindCreateGroupToJson implements MapBinder {
> +
> + @Inject
> + private BindToJsonPayload jsonBinder;
You're right. IMHO, though, using constructor injection has some benefits.
using it + final fields forces the user to provide all dependencies, and if a
new member is introduced, all the code that constructs the object just breaks.
Unis tests are a common place where you may manually build the object. It is a
good way to make sure all injected fields will be always present.
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs-openstack/pull/22/files#r6026206