/** * Builds a new {@link ResourceIdentifier ResourceIdentifier}. * @return An immutable instance of ResourceIdentifier * @throws java.lang.IllegalStateException if any required attributes are missing */ public ResourceIdentifier build() { return ImmutableResourceIdentifier.validate(new ImmutableResourceIdentifier(null, kind, name, version, id)); } }
/** * Copy the current immutable object by setting a <i>present</i> value for the optional {@link ResourceIdentifier#getVersion() version} attribute. * @param value The value for version * @return A modified copy of {@code this} object */ public final ImmutableResourceIdentifier withVersion(int value) { @Nullable Integer newValue = value; if (Objects.equals(this.version, newValue)) return this; return validate(new ImmutableResourceIdentifier(this, this.kind, this.name, newValue, this.id)); }
/** * Copy the current immutable object by setting a <i>present</i> value for the optional {@link ResourceIdentifier#getId() id} attribute. * @param value The value for id * @return A modified copy of {@code this} object */ public final ImmutableResourceIdentifier withId(String value) { @Nullable String newValue = Objects.requireNonNull(value, "id"); if (Objects.equals(this.id, newValue)) return this; return validate(new ImmutableResourceIdentifier(this, this.kind, this.name, this.version, newValue)); }
/** * Copy the current immutable object by setting an optional value for the {@link ResourceIdentifier#name() name} 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 name * @return A modified copy of {@code this} object */ public final ImmutableResourceIdentifier withName(Optional<String> optional) { @Nullable String value = optional.orElse(null); if (Objects.equals(this.name, value)) return this; return validate(new ImmutableResourceIdentifier(this, this.kind, value, this.version, this.id)); }
/** * Copy the current immutable object by setting an optional value for the {@link ResourceIdentifier#getVersion() version} 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 version * @return A modified copy of {@code this} object */ public final ImmutableResourceIdentifier withVersion(Optional<Integer> optional) { @Nullable Integer value = optional.orElse(null); if (Objects.equals(this.version, value)) return this; return validate(new ImmutableResourceIdentifier(this, this.kind, this.name, value, this.id)); }
/** * Copy the current immutable object by setting a value for the {@link ResourceIdentifier#getKind() kind} attribute. * A value equality check is used to prevent copying of the same value by returning {@code this}. * @param value A new value for kind (can be {@code null}) * @return A modified copy of the {@code this} object */ public final ImmutableResourceIdentifier withKind(Kind value) { if (this.kind == value) return this; return validate(new ImmutableResourceIdentifier(this, value, this.name, this.version, this.id)); }
/** * Copy the current immutable object by setting a <i>present</i> value for the optional {@link ResourceIdentifier#name() name} attribute. * @param value The value for name * @return A modified copy of {@code this} object */ public final ImmutableResourceIdentifier withName(String value) { @Nullable String newValue = Objects.requireNonNull(value, "name"); if (Objects.equals(this.name, newValue)) return this; return validate(new ImmutableResourceIdentifier(this, this.kind, newValue, this.version, this.id)); }
/** * Copy the current immutable object by setting an optional value for the {@link ResourceIdentifier#getId() id} 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 id * @return A modified copy of {@code this} object */ public final ImmutableResourceIdentifier withId(Optional<String> optional) { @Nullable String value = optional.orElse(null); if (Objects.equals(this.id, value)) return this; return validate(new ImmutableResourceIdentifier(this, this.kind, this.name, this.version, value)); }
/** * Construct a new immutable {@code ResourceIdentifier} instance. * @param kind The value for the {@code kind} attribute * @param name The value for the {@code name} attribute * @param version The value for the {@code version} attribute * @param id The value for the {@code id} attribute * @return An immutable ResourceIdentifier instance */ public static ResourceIdentifier of(Kind kind, Optional<String> name, Optional<Integer> version, Optional<String> id) { return validate(new ImmutableResourceIdentifier(kind, name, version, id)); }