@Override public Builder setComponents(Collection<ComponentContext> components) { Args.checkNotNull(components, "components cannot be null"); network.components.clear(); for (ComponentContext component : components) { network.components.put(component.name(), component); } return this; }
@Override public NetworkContext.Builder setAddress(String address) { network.address = Args.checkNotNull(address, "address cannot be null"); return this; }
@Override public NetworkContext.Builder setName(String name) { Args.checkNotNull(name, "name cannot be null"); network.name = name; return this; }
/** Checks network fields. */ private void checkFields() { Args.checkNotNull(network.name, "name cannot be null"); Args.checkNotNull(network.version, "version cannot be null"); Args.checkNotNull(network.config, "configuration cannot be null"); Args.checkNotNull(network.components, "components cannot be null"); }
@Override public Builder removeComponent(ComponentContext component) { Args.checkNotNull(component, "component cannot be null"); network.components.remove(component.name()); return this; }
@Override public Builder setConfig(NetworkConfig config) { Args.checkNotNull(config, "configuration cannot be null"); network.config = config; return this; }
@Override public Builder setVersion(String version) { Args.checkNotNull(version, "version cannot be null"); network.version = version; return this; }