javadoc to clarify options additivity

This commit is contained in:
Alex Heneveld 2012-05-18 21:36:22 +01:00
parent c181bc1d1a
commit 181824bbf0
2 changed files with 10 additions and 3 deletions

View File

@ -162,8 +162,10 @@ public interface TemplateBuilder {
Template build();
/**
* options such as inbound ports and run scripts.
* Sets options on the template (i.e. items which adorn a created node rather than restricting selection of the node).
* Note that this method typically replaces any options previously specified in the builder.
* Normal usage is to build up all options and pass them to the builder with a single call to this method.
*/
TemplateBuilder options(TemplateOptions options);
}
}

View File

@ -43,7 +43,7 @@ import com.google.common.primitives.Ints;
* operation. <h2>
* Usage</h2> The recommended way to instantiate a TemplateOptions object is to
* statically import TemplateOptions.* and invoke a static creation method
* followed by an instance mutator (if needed):
* followed by any/all desired instance mutators.
* <p/>
* <code>
* import static org.jclouds.compute.options.TemplateOptions.Builder.*;
@ -52,6 +52,11 @@ import com.google.common.primitives.Ints;
* templateBuilder.options(inboundPorts(22, 80, 8080, 443));
* Set<? extends NodeMetadata> set = client.createNodesInGroup(tag, 2, templateBuilder.build());
* <code>
* <p/>
* Note that options can only be assigned to a builder once, so if assigning e.g. inboundPorts and tags,
* that must be done in with mutators in a single call to options --
* <code>templateBuilder.options(inboundPorts(22, 80, 8080, 443).tags("I love it!"))</code>
* -- not as repeated calls to <code>options</code>.
*
* @author Adrian Cole
*/