/** * Copy the current immutable object by setting a value for the {@link Config#getServer() server} attribute. * A value equality check is used to prevent copying of the same value by returning {@code this}. * @param value A new value for server * @return A modified copy of the {@code this} object */ public final ImmutableConfig withServer(boolean value) { if (this.server == value) return this; return new ImmutableConfig(this.datacenter, this.nodeName, this.revision, value, this.version); }
/** * Copy the current immutable object by setting a value for the {@link Config#getVersion() version} attribute. * An equals check used to prevent copying of the same value by returning {@code this}. * @param value A new value for version * @return A modified copy of the {@code this} object */ public final ImmutableConfig withVersion(String value) { if (this.version.equals(value)) return this; return new ImmutableConfig( this.datacenter, this.nodeName, this.revision, this.server, Preconditions.checkNotNull(value, "version")); }
/** * Copy the current immutable object by setting a value for the {@link Config#getDatacenter() datacenter} attribute. * An equals check used to prevent copying of the same value by returning {@code this}. * @param value A new value for datacenter * @return A modified copy of the {@code this} object */ public final ImmutableConfig withDatacenter(String value) { if (this.datacenter.equals(value)) return this; return new ImmutableConfig( Preconditions.checkNotNull(value, "datacenter"), this.nodeName, this.revision, this.server, this.version); }
/** * Copy the current immutable object by setting a value for the {@link Config#getNodeName() nodeName} attribute. * An equals check used to prevent copying of the same value by returning {@code this}. * @param value A new value for nodeName * @return A modified copy of the {@code this} object */ public final ImmutableConfig withNodeName(String value) { if (this.nodeName.equals(value)) return this; return new ImmutableConfig( this.datacenter, Preconditions.checkNotNull(value, "nodeName"), this.revision, this.server, this.version); }
/** * Copy the current immutable object by setting a value for the {@link Config#getRevision() revision} attribute. * An equals check used to prevent copying of the same value by returning {@code this}. * @param value A new value for revision * @return A modified copy of the {@code this} object */ public final ImmutableConfig withRevision(String value) { if (this.revision.equals(value)) return this; return new ImmutableConfig( this.datacenter, this.nodeName, Preconditions.checkNotNull(value, "revision"), this.server, this.version); }
/** * Builds a new {@link ImmutableConfig ImmutableConfig}. * @return An immutable instance of Config * @throws java.lang.IllegalStateException if any required attributes are missing */ public ImmutableConfig build() { if (initBits != 0) { throw new IllegalStateException(formatRequiredAttributesMessage()); } return new ImmutableConfig(datacenter, nodeName, revision, server, version); }