/** * 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); }
/** * This instance is equal to all instances of {@code ImmutableConfig} that have equal attribute values. * @return {@code true} if {@code this} is equal to {@code another} instance */ @Override public boolean equals(@Nullable Object another) { if (this == another) return true; return another instanceof ImmutableConfig && equalTo((ImmutableConfig) another); }
/** * Creates an immutable copy of a {@link Config} value. * Uses accessors to get values to initialize the new immutable instance. * If an instance is already immutable, it is returned as is. * @param instance The instance to copy * @return A copied immutable Config instance */ public static ImmutableConfig copyOf(Config instance) { if (instance instanceof ImmutableConfig) { return (ImmutableConfig) instance; } return ImmutableConfig.builder() .from(instance) .build(); }
/** * @param json A JSON-bindable data structure * @return An immutable value type * @deprecated Do not use this method directly, it exists only for the <em>Jackson</em>-binding infrastructure */ @Deprecated @JsonCreator static ImmutableConfig fromJson(Json json) { ImmutableConfig.Builder builder = ImmutableConfig.builder(); if (json.datacenter != null) { builder.datacenter(json.datacenter); } if (json.nodeName != null) { builder.nodeName(json.nodeName); } if (json.revision != null) { builder.revision(json.revision); } if (json.server != null) { builder.server(json.server); } if (json.version != null) { builder.version(json.version); } return builder.build(); }
/** * 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); }