/** * Copy the current immutable object with elements that replace the content of {@link Registration#getTags() tags}. * @param elements The elements to set * @return A modified copy of {@code this} object */ public final ImmutableRegistration withTags(String... elements) { ImmutableList<String> newValue = ImmutableList.copyOf(elements); return new ImmutableRegistration( this.name, this.id, this.address, this.port, this.check, this.checks, newValue, this.meta, this.enableTagOverride); }
/** * Copy the current immutable object with elements that replace the content of {@link Registration#getChecks() checks}. * @param elements The elements to set * @return A modified copy of {@code this} object */ public final ImmutableRegistration withChecks(Registration.RegCheck... elements) { ImmutableList<Registration.RegCheck> newValue = ImmutableList.copyOf(elements); return new ImmutableRegistration( this.name, this.id, this.address, this.port, this.check, newValue, this.tags, this.meta, this.enableTagOverride); }
/** * Copy the current immutable object with elements that replace the content of {@link Registration#getChecks() checks}. * A shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param elements An iterable of checks elements to set * @return A modified copy of {@code this} object */ public final ImmutableRegistration withChecks(Iterable<? extends Registration.RegCheck> elements) { if (this.checks == elements) return this; ImmutableList<Registration.RegCheck> newValue = ImmutableList.copyOf(elements); return new ImmutableRegistration( this.name, this.id, this.address, this.port, this.check, newValue, this.tags, this.meta, this.enableTagOverride); }
/** * Copy the current immutable object with elements that replace the content of {@link Registration#getTags() tags}. * A shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param elements An iterable of tags elements to set * @return A modified copy of {@code this} object */ public final ImmutableRegistration withTags(Iterable<String> elements) { if (this.tags == elements) return this; ImmutableList<String> newValue = ImmutableList.copyOf(elements); return new ImmutableRegistration( this.name, this.id, this.address, this.port, this.check, this.checks, newValue, this.meta, this.enableTagOverride); }
/** * Copy the current immutable object by setting a <i>present</i> value for the optional {@link Registration#getEnableTagOverride() enableTagOverride} attribute. * @param value The value for enableTagOverride * @return A modified copy of {@code this} object */ public final ImmutableRegistration withEnableTagOverride(boolean value) { @Nullable Boolean newValue = value; if (Objects.equals(this.enableTagOverride, newValue)) return this; return new ImmutableRegistration( this.name, this.id, this.address, this.port, this.check, this.checks, this.tags, this.meta, newValue); }
/** * Copy the current immutable object by replacing the {@link Registration#getMeta() meta} map with the specified map. * Nulls are not permitted as keys or values. * A shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param entries The entries to be added to the meta map * @return A modified copy of {@code this} object */ public final ImmutableRegistration withMeta(Map<String, ? extends String> entries) { if (this.meta == entries) return this; ImmutableMap<String, String> value = ImmutableMap.copyOf(entries); return new ImmutableRegistration( this.name, this.id, this.address, this.port, this.check, this.checks, this.tags, value, this.enableTagOverride); }
/** * Copy the current immutable object by setting a <i>present</i> value for the optional {@link Registration#getCheck() check} attribute. * @param value The value for check * @return A modified copy of {@code this} object */ public final ImmutableRegistration withCheck(Registration.RegCheck value) { @Nullable Registration.RegCheck newValue = Preconditions.checkNotNull(value, "check"); if (this.check == newValue) return this; return new ImmutableRegistration( this.name, this.id, this.address, this.port, newValue, this.checks, this.tags, this.meta, this.enableTagOverride); }
/** * Copy the current immutable object by setting an optional value for the {@link Registration#getCheck() check} attribute. * A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returning {@code this}. * @param optional A value for check * @return A modified copy of {@code this} object */ public final ImmutableRegistration withCheck(Optional<Registration.RegCheck> optional) { @Nullable Registration.RegCheck value = optional.orElse(null); if (this.check == value) return this; return new ImmutableRegistration( this.name, this.id, this.address, this.port, value, this.checks, this.tags, this.meta, this.enableTagOverride); }
/** * Copy the current immutable object by setting a value for the {@link Registration#getName() name} attribute. * An equals check used to prevent copying of the same value by returning {@code this}. * @param value A new value for name * @return A modified copy of the {@code this} object */ public final ImmutableRegistration withName(String value) { if (this.name.equals(value)) return this; return new ImmutableRegistration( Preconditions.checkNotNull(value, "name"), this.id, this.address, this.port, this.check, this.checks, this.tags, this.meta, this.enableTagOverride); }
/** * Copy the current immutable object by setting a value for the {@link Registration#getId() id} attribute. * An equals check used to prevent copying of the same value by returning {@code this}. * @param value A new value for id * @return A modified copy of the {@code this} object */ public final ImmutableRegistration withId(String value) { if (this.id.equals(value)) return this; return new ImmutableRegistration( this.name, Preconditions.checkNotNull(value, "id"), this.address, this.port, this.check, this.checks, this.tags, this.meta, this.enableTagOverride); }
/** * Copy the current immutable object by setting a <i>present</i> value for the optional {@link Registration#getPort() port} attribute. * @param value The value for port * @return A modified copy of {@code this} object */ public final ImmutableRegistration withPort(int value) { @Nullable Integer newValue = value; if (Objects.equals(this.port, newValue)) return this; return new ImmutableRegistration( this.name, this.id, this.address, newValue, this.check, this.checks, this.tags, this.meta, this.enableTagOverride); }
/** * Copy the current immutable object by setting an optional value for the {@link Registration#getEnableTagOverride() enableTagOverride} attribute. * An equality check is used on inner nullable value to prevent copying of the same value by returning {@code this}. * @param optional A value for enableTagOverride * @return A modified copy of {@code this} object */ public final ImmutableRegistration withEnableTagOverride(Optional<Boolean> optional) { @Nullable Boolean value = optional.orElse(null); if (Objects.equals(this.enableTagOverride, value)) return this; return new ImmutableRegistration( this.name, this.id, this.address, this.port, this.check, this.checks, this.tags, this.meta, value); }
/** * Copy the current immutable object by setting a <i>present</i> value for the optional {@link Registration#getAddress() address} attribute. * @param value The value for address * @return A modified copy of {@code this} object */ public final ImmutableRegistration withAddress(String value) { @Nullable String newValue = Preconditions.checkNotNull(value, "address"); if (Objects.equals(this.address, newValue)) return this; return new ImmutableRegistration( this.name, this.id, newValue, this.port, this.check, this.checks, this.tags, this.meta, this.enableTagOverride); }
/** * Copy the current immutable object by setting an optional value for the {@link Registration#getPort() port} attribute. * An equality check is used on inner nullable value to prevent copying of the same value by returning {@code this}. * @param optional A value for port * @return A modified copy of {@code this} object */ public final ImmutableRegistration withPort(Optional<Integer> optional) { @Nullable Integer value = optional.orElse(null); if (Objects.equals(this.port, value)) return this; return new ImmutableRegistration( this.name, this.id, this.address, value, this.check, this.checks, this.tags, this.meta, this.enableTagOverride); }
/** * Copy the current immutable object by setting an optional value for the {@link Registration#getAddress() address} attribute. * An equality check is used on inner nullable value to prevent copying of the same value by returning {@code this}. * @param optional A value for address * @return A modified copy of {@code this} object */ public final ImmutableRegistration withAddress(Optional<String> optional) { @Nullable String value = optional.orElse(null); if (Objects.equals(this.address, value)) return this; return new ImmutableRegistration( this.name, this.id, value, this.port, this.check, this.checks, this.tags, this.meta, this.enableTagOverride); }
/** * Builds a new {@link ImmutableRegistration ImmutableRegistration}. * @return An immutable instance of Registration * @throws java.lang.IllegalStateException if any required attributes are missing */ public ImmutableRegistration build() { if (initBits != 0) { throw new IllegalStateException(formatRequiredAttributesMessage()); } return new ImmutableRegistration( name, id, address, port, check, checksBuilder.build(), tagsBuilder.build(), metaBuilder.build(), enableTagOverride); }