/** * Construct a new immutable {@code ConnectorAction} instance. * @param actionType The value for the {@code actionType} attribute * @param descriptor The value for the {@code descriptor} attribute * @param description The value for the {@code description} attribute * @param pattern The value for the {@code pattern} attribute * @param id The value for the {@code id} attribute * @param name The value for the {@code name} attribute * @param tags The value for the {@code tags} attribute * @param metadata The value for the {@code metadata} attribute * @return An immutable ConnectorAction instance */ public static ConnectorAction of(String actionType, ConnectorDescriptor descriptor, String description, Action.Pattern pattern, Optional<String> id, String name, Iterable<String> tags, Map<String, ? extends String> metadata) { return validate(new ImmutableConnectorAction(actionType, descriptor, description, pattern, id, name, tags, metadata)); }
/** * Copy the current immutable object with elements that replace the content of {@link ConnectorAction#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 ImmutableConnectorAction withTags(Iterable<String> elements) { if (this.tags == elements) return this; SortedSet<String> newValue = createUnmodifiableSortedSet(false, createSafeList(elements, false, true)); return validate(new ImmutableConnectorAction( this, this.actionType, this.descriptor, this.description, this.pattern, this.id, this.name, newValue, this.metadata)); }
/** * Copy the current immutable object by replacing the {@link ConnectorAction#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 ImmutableConnectorAction withMetadata(Map<String, ? extends String> entries) { if (this.metadata == entries) return this; Map<String, String> newValue = createUnmodifiableMap(true, false, entries); return validate(new ImmutableConnectorAction( this, this.actionType, this.descriptor, this.description, this.pattern, this.id, this.name, this.tags, newValue)); }
private ImmutableConnectorAction( String actionType, ConnectorDescriptor descriptor, String description, Action.Pattern pattern, Optional<String> id, String name, Iterable<String> tags, Map<String, ? extends String> metadata) { this.actionType = Objects.requireNonNull(actionType, "actionType"); this.descriptor = descriptor; this.description = description; this.pattern = pattern; this.id = id.orElse(null); this.name = name; this.tags = createUnmodifiableSortedSet(false, createSafeList(tags, false, true)); this.metadata = createUnmodifiableMap(true, false, metadata); initShim.actionType(this.actionType); initShim.metadata(this.metadata); this.initShim = null; }
/** * Builds a new {@link ConnectorAction ConnectorAction}. * @return An immutable instance of ConnectorAction * @throws java.lang.IllegalStateException if any required attributes are missing */ public ConnectorAction build() { return ImmutableConnectorAction.validate(new ImmutableConnectorAction(this)); }
private Object readResolve() throws ObjectStreamException { return validate(this); }
/** * Construct a new immutable {@code ConnectorAction} instance. * @param actionType The value for the {@code actionType} attribute * @param descriptor The value for the {@code descriptor} attribute * @param description The value for the {@code description} attribute * @param pattern The value for the {@code pattern} attribute * @param id The value for the {@code id} attribute * @param name The value for the {@code name} attribute * @param tags The value for the {@code tags} attribute * @param metadata The value for the {@code metadata} attribute * @return An immutable ConnectorAction instance */ public static ConnectorAction of(String actionType, ConnectorDescriptor descriptor, String description, Action.Pattern pattern, Optional<String> id, String name, SortedSet<String> tags, Map<String, String> metadata) { return of(actionType, descriptor, description, pattern, id, name, (Iterable<String>) tags, metadata); }
/** * This instance is equal to all instances of {@code ImmutableConnectorAction} 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 ImmutableConnectorAction && equalTo((ImmutableConnectorAction) another); }
private ImmutableConnectorAction(ImmutableConnectorAction.Builder builder) { this.descriptor = builder.descriptor; this.description = builder.description; this.pattern = builder.pattern; this.id = builder.id; this.name = builder.name; this.tags = createUnmodifiableSortedSet(false, createSafeList(builder.tags, false, false)); if (builder.actionType != null) { initShim.actionType(builder.actionType); } if (builder.metadataIsSet()) { initShim.metadata(createUnmodifiableMap(false, false, builder.metadata)); } this.actionType = initShim.getActionType(); this.metadata = initShim.getMetadata(); this.initShim = null; }
/** * Copy the current immutable object by setting a value for the {@link ConnectorAction#getPattern() pattern} attribute. * A value equality check is used to prevent copying of the same value by returning {@code this}. * @param value A new value for pattern (can be {@code null}) * @return A modified copy of the {@code this} object */ public final ImmutableConnectorAction withPattern(Action.Pattern value) { if (this.pattern == value) return this; return validate(new ImmutableConnectorAction( this, this.actionType, this.descriptor, this.description, value, this.id, this.name, this.tags, this.metadata)); }
/** * Copy the current immutable object with elements that replace the content of {@link ConnectorAction#getTags() tags}. * @param elements The elements to set * @return A modified copy of {@code this} object */ public final ImmutableConnectorAction withTags(String... elements) { SortedSet<String> newValue = createUnmodifiableSortedSet(false, createSafeList(Arrays.asList(elements), false, true)); return validate(new ImmutableConnectorAction( this, this.actionType, this.descriptor, this.description, this.pattern, this.id, this.name, newValue, this.metadata)); }
/** * Copy the current immutable object by setting a value for the {@link ConnectorAction#getDescriptor() descriptor} attribute. * A shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param value A new value for descriptor (can be {@code null}) * @return A modified copy of the {@code this} object */ public final ImmutableConnectorAction withDescriptor(ConnectorDescriptor value) { if (this.descriptor == value) return this; return validate(new ImmutableConnectorAction( this, this.actionType, value, this.description, this.pattern, this.id, this.name, this.tags, this.metadata)); }
/** * Copy the current immutable object by setting a value for the {@link ConnectorAction#getDescription() description} attribute. * An equals check used to prevent copying of the same value by returning {@code this}. * @param value A new value for description (can be {@code null}) * @return A modified copy of the {@code this} object */ public final ImmutableConnectorAction withDescription(String value) { if (Objects.equals(this.description, value)) return this; return validate(new ImmutableConnectorAction( this, this.actionType, this.descriptor, value, this.pattern, this.id, this.name, this.tags, this.metadata)); }
/** * Copy the current immutable object by setting a value for the {@link ConnectorAction#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 ImmutableConnectorAction withName(String value) { if (Objects.equals(this.name, value)) return this; return validate(new ImmutableConnectorAction( this, this.actionType, this.descriptor, this.description, this.pattern, this.id, value, this.tags, this.metadata)); }
/** * Copy the current immutable object by setting a value for the {@link ConnectorAction#getActionType() actionType} attribute. * An equals check used to prevent copying of the same value by returning {@code this}. * @param value A new value for actionType * @return A modified copy of the {@code this} object */ public final ImmutableConnectorAction withActionType(String value) { if (this.actionType.equals(value)) return this; String newValue = Objects.requireNonNull(value, "actionType"); return validate(new ImmutableConnectorAction( this, newValue, this.descriptor, this.description, this.pattern, this.id, this.name, this.tags, this.metadata)); }
/** * Copy the current immutable object by setting an optional value for the {@link ConnectorAction#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 ImmutableConnectorAction withId(Optional<String> optional) { @Nullable String value = optional.orElse(null); if (Objects.equals(this.id, value)) return this; return validate(new ImmutableConnectorAction( this, this.actionType, this.descriptor, this.description, this.pattern, value, this.name, this.tags, this.metadata)); }
/** * Copy the current immutable object by setting a <i>present</i> value for the optional {@link ConnectorAction#getId() id} attribute. * @param value The value for id * @return A modified copy of {@code this} object */ public final ImmutableConnectorAction withId(String value) { @Nullable String newValue = Objects.requireNonNull(value, "id"); if (Objects.equals(this.id, newValue)) return this; return validate(new ImmutableConnectorAction( this, this.actionType, this.descriptor, this.description, this.pattern, newValue, this.name, this.tags, this.metadata)); }