/** * Builds a new {@link Connection Connection}. * @return An immutable instance of Connection * @throws java.lang.IllegalStateException if any required attributes are missing */ public Connection build() { return ImmutableConnection.validate(new ImmutableConnection(this)); }
/** * Construct a new immutable {@code Connection} instance. * @param id The value for the {@code id} attribute * @param organization The value for the {@code organization} attribute * @param organizationId The value for the {@code organizationId} attribute * @param connector The value for the {@code connector} attribute * @param connectorId The value for the {@code connectorId} attribute * @param options The value for the {@code options} attribute * @param icon The value for the {@code icon} attribute * @param description The value for the {@code description} attribute * @param userId The value for the {@code userId} attribute * @param lastUpdated The value for the {@code lastUpdated} attribute * @param createdDate The value for the {@code createdDate} attribute * @param isDerived The value for the {@code isDerived} attribute * @param uses The value for the {@code uses} attribute * @param tags The value for the {@code tags} attribute * @param name The value for the {@code name} attribute * @param configuredProperties The value for the {@code configuredProperties} attribute * @param metadata The value for the {@code metadata} attribute * @return An immutable Connection instance */ public static Connection of(Optional<String> id, Optional<Organization> organization, Optional<String> organizationId, Optional<Connector> connector, String connectorId, Map<String, ? extends String> options, String icon, Optional<String> description, Optional<String> userId, Optional<Date> lastUpdated, Optional<Date> createdDate, boolean isDerived, OptionalInt uses, Iterable<String> tags, String name, Map<String, ? extends String> configuredProperties, Map<String, ? extends String> metadata) { return validate(new ImmutableConnection(id, organization, organizationId, connector, connectorId, options, icon, description, userId, lastUpdated, createdDate, isDerived, uses, tags, name, configuredProperties, metadata)); }
/** * Copy the current immutable object by setting a <i>present</i> value for the optional {@link Connection#getCreatedDate() createdDate} attribute. * @param value The value for createdDate * @return A modified copy of {@code this} object */ public final ImmutableConnection withCreatedDate(Date value) { @Nullable Date newValue = Objects.requireNonNull(value, "createdDate"); if (this.createdDate == newValue) return this; return validate(new ImmutableConnection( this, this.id, this.organization, this.organizationId, this.connector, this.connectorId, this.options, this.icon, this.description, this.userId, this.lastUpdated, newValue, this.isDerived, this.uses, this.tags, this.name, this.configuredProperties, this.metadata)); }
/** * Copy the current immutable object by setting a <i>present</i> value for the optional {@link Connection#getUses() uses} attribute. * @param value The value for uses * @return A modified copy of {@code this} object */ public final ImmutableConnection withUses(int value) { @Nullable Integer newValue = value; if (Objects.equals(this.uses, newValue)) return this; return validate(new ImmutableConnection( this, this.id, this.organization, this.organizationId, this.connector, this.connectorId, this.options, this.icon, this.description, this.userId, this.lastUpdated, this.createdDate, this.isDerived, newValue, this.tags, this.name, this.configuredProperties, this.metadata)); }
/** * Copy the current immutable object by setting a value for the {@link Connection#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 (can be {@code null}) * @return A modified copy of the {@code this} object */ public final ImmutableConnection withName(String value) { if (Objects.equals(this.name, value)) return this; return validate(new ImmutableConnection( this, this.id, this.organization, this.organizationId, this.connector, this.connectorId, this.options, this.icon, this.description, this.userId, this.lastUpdated, this.createdDate, this.isDerived, this.uses, this.tags, value, this.configuredProperties, this.metadata)); }
/** * Copy the current immutable object by setting a <i>present</i> value for the optional {@link Connection#getId() id} attribute. * @param value The value for id * @return A modified copy of {@code this} object */ public final ImmutableConnection withId(String value) { @Nullable String newValue = Objects.requireNonNull(value, "id"); if (Objects.equals(this.id, newValue)) return this; return validate(new ImmutableConnection( this, newValue, this.organization, this.organizationId, this.connector, this.connectorId, this.options, this.icon, this.description, this.userId, this.lastUpdated, this.createdDate, this.isDerived, this.uses, this.tags, this.name, this.configuredProperties, this.metadata)); }
/** * Copy the current immutable object by setting a value for the {@link Connection#getConnectorId() connectorId} attribute. * An equals check used to prevent copying of the same value by returning {@code this}. * @param value A new value for connectorId (can be {@code null}) * @return A modified copy of the {@code this} object */ public final ImmutableConnection withConnectorId(String value) { if (Objects.equals(this.connectorId, value)) return this; return validate(new ImmutableConnection( this, this.id, this.organization, this.organizationId, this.connector, value, this.options, this.icon, this.description, this.userId, this.lastUpdated, this.createdDate, this.isDerived, this.uses, this.tags, this.name, this.configuredProperties, this.metadata)); }
/** * Copy the current immutable object by setting a <i>present</i> value for the optional {@link Connection#getConnector() connector} attribute. * @param value The value for connector * @return A modified copy of {@code this} object */ public final ImmutableConnection withConnector(Connector value) { @Nullable Connector newValue = Objects.requireNonNull(value, "connector"); if (this.connector == newValue) return this; return validate(new ImmutableConnection( this, this.id, this.organization, this.organizationId, newValue, this.connectorId, this.options, this.icon, this.description, this.userId, this.lastUpdated, this.createdDate, this.isDerived, this.uses, this.tags, this.name, this.configuredProperties, this.metadata)); }
/** * Copy the current immutable object by setting a <i>present</i> value for the optional {@link Connection#getLastUpdated() lastUpdated} attribute. * @param value The value for lastUpdated * @return A modified copy of {@code this} object */ public final ImmutableConnection withLastUpdated(Date value) { @Nullable Date newValue = Objects.requireNonNull(value, "lastUpdated"); if (this.lastUpdated == newValue) return this; return validate(new ImmutableConnection( this, this.id, this.organization, this.organizationId, this.connector, this.connectorId, this.options, this.icon, this.description, this.userId, newValue, this.createdDate, this.isDerived, this.uses, this.tags, this.name, this.configuredProperties, this.metadata)); }
/** * Copy the current immutable object by setting an optional value for the {@link Connection#getLastUpdated() lastUpdated} 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 lastUpdated * @return A modified copy of {@code this} object */ public final ImmutableConnection withLastUpdated(Optional<? extends Date> optional) { @Nullable Date value = optional.orElse(null); if (this.lastUpdated == value) return this; return validate(new ImmutableConnection( this, this.id, this.organization, this.organizationId, this.connector, this.connectorId, this.options, this.icon, this.description, this.userId, value, this.createdDate, this.isDerived, this.uses, this.tags, this.name, this.configuredProperties, this.metadata)); }
/** * Copy the current immutable object by setting an optional value for the {@link Connection#getOrganizationId() organizationId} 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 organizationId * @return A modified copy of {@code this} object */ public final ImmutableConnection withOrganizationId(Optional<String> optional) { @Nullable String value = optional.orElse(null); if (Objects.equals(this.organizationId, value)) return this; return validate(new ImmutableConnection( this, this.id, this.organization, value, this.connector, this.connectorId, this.options, this.icon, this.description, this.userId, this.lastUpdated, this.createdDate, this.isDerived, this.uses, this.tags, this.name, this.configuredProperties, this.metadata)); }
/** * Copy the current immutable object by setting an optional value for the {@link Connection#getCreatedDate() createdDate} 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 createdDate * @return A modified copy of {@code this} object */ public final ImmutableConnection withCreatedDate(Optional<? extends Date> optional) { @Nullable Date value = optional.orElse(null); if (this.createdDate == value) return this; return validate(new ImmutableConnection( this, this.id, this.organization, this.organizationId, this.connector, this.connectorId, this.options, this.icon, this.description, this.userId, this.lastUpdated, value, this.isDerived, this.uses, this.tags, this.name, this.configuredProperties, this.metadata)); }
/** * Copy the current immutable object by setting an optional value for the {@link Connection#getUses() uses} 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 uses * @return A modified copy of {@code this} object */ public final ImmutableConnection withUses(OptionalInt optional) { @Nullable Integer value = optional.isPresent() ? optional.getAsInt() : null; if (Objects.equals(this.uses, value)) return this; return validate(new ImmutableConnection( this, this.id, this.organization, this.organizationId, this.connector, this.connectorId, this.options, this.icon, this.description, this.userId, this.lastUpdated, this.createdDate, this.isDerived, value, this.tags, this.name, this.configuredProperties, this.metadata)); }
/** * Copy the current immutable object by setting a value for the {@link Connection#isDerived() isDerived} attribute. * A value equality check is used to prevent copying of the same value by returning {@code this}. * @param value A new value for isDerived * @return A modified copy of the {@code this} object */ public final ImmutableConnection withIsDerived(boolean value) { if (this.isDerived == value) return this; return validate(new ImmutableConnection( this, this.id, this.organization, this.organizationId, this.connector, this.connectorId, this.options, this.icon, this.description, this.userId, this.lastUpdated, this.createdDate, value, this.uses, this.tags, this.name, this.configuredProperties, this.metadata)); }
/** * Copy the current immutable object by setting an optional value for the {@link Connection#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 ImmutableConnection withId(Optional<String> optional) { @Nullable String value = optional.orElse(null); if (Objects.equals(this.id, value)) return this; return validate(new ImmutableConnection( this, value, this.organization, this.organizationId, this.connector, this.connectorId, this.options, this.icon, this.description, this.userId, this.lastUpdated, this.createdDate, this.isDerived, this.uses, this.tags, this.name, this.configuredProperties, this.metadata)); }
/** * Copy the current immutable object by setting an optional value for the {@link Connection#getUserId() userId} 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 userId * @return A modified copy of {@code this} object */ public final ImmutableConnection withUserId(Optional<String> optional) { @Nullable String value = optional.orElse(null); if (Objects.equals(this.userId, value)) return this; return validate(new ImmutableConnection( this, this.id, this.organization, this.organizationId, this.connector, this.connectorId, this.options, this.icon, this.description, value, this.lastUpdated, this.createdDate, this.isDerived, this.uses, this.tags, this.name, this.configuredProperties, this.metadata)); }
/** * Copy the current immutable object by replacing the {@link Connection#getOptions() options} 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 options map * @return A modified copy of {@code this} object */ public final ImmutableConnection withOptions(Map<String, ? extends String> entries) { if (this.options == entries) return this; Map<String, String> newValue = createUnmodifiableMap(true, false, entries); return validate(new ImmutableConnection( this, this.id, this.organization, this.organizationId, this.connector, this.connectorId, newValue, this.icon, this.description, this.userId, this.lastUpdated, this.createdDate, this.isDerived, this.uses, this.tags, this.name, this.configuredProperties, this.metadata)); }
/** * Copy the current immutable object by replacing the {@link Connection#getMetadata() metadata} 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 metadata map * @return A modified copy of {@code this} object */ public final ImmutableConnection withMetadata(Map<String, ? extends String> entries) { if (this.metadata == entries) return this; Map<String, String> newValue = createUnmodifiableMap(true, false, entries); return validate(new ImmutableConnection( this, this.id, this.organization, this.organizationId, this.connector, this.connectorId, this.options, this.icon, this.description, this.userId, this.lastUpdated, this.createdDate, this.isDerived, this.uses, this.tags, this.name, this.configuredProperties, newValue)); }
/** * Copy the current immutable object with elements that replace the content of {@link Connection#getTags() tags}. * @param elements The elements to set * @return A modified copy of {@code this} object */ public final ImmutableConnection withTags(String... elements) { SortedSet<String> newValue = createUnmodifiableSortedSet(false, createSafeList(Arrays.asList(elements), false, true)); return validate(new ImmutableConnection( this, this.id, this.organization, this.organizationId, this.connector, this.connectorId, this.options, this.icon, this.description, this.userId, this.lastUpdated, this.createdDate, this.isDerived, this.uses, newValue, this.name, this.configuredProperties, this.metadata)); }
/** * Copy the current immutable object with elements that replace the content of {@link Connection#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 ImmutableConnection withTags(Iterable<String> elements) { if (this.tags == elements) return this; SortedSet<String> newValue = createUnmodifiableSortedSet(false, createSafeList(elements, false, true)); return validate(new ImmutableConnection( this, this.id, this.organization, this.organizationId, this.connector, this.connectorId, this.options, this.icon, this.description, this.userId, this.lastUpdated, this.createdDate, this.isDerived, this.uses, newValue, this.name, this.configuredProperties, this.metadata)); }