
software.amazon.awssdk.services.dynamodb.model.StreamDescription Maven / Gradle / Ivy
/*
* Copyright 2013-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package software.amazon.awssdk.services.dynamodb.model;
import java.time.Instant;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.function.Consumer;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.annotations.SdkInternalApi;
import software.amazon.awssdk.core.protocol.ProtocolMarshaller;
import software.amazon.awssdk.core.protocol.StructuredPojo;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.services.dynamodb.transform.StreamDescriptionMarshaller;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Represents all of the data describing a particular stream.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class StreamDescription implements StructuredPojo, ToCopyableBuilder {
private final String streamArn;
private final String streamLabel;
private final String streamStatus;
private final String streamViewType;
private final Instant creationRequestDateTime;
private final String tableName;
private final List keySchema;
private final List shards;
private final String lastEvaluatedShardId;
private StreamDescription(BuilderImpl builder) {
this.streamArn = builder.streamArn;
this.streamLabel = builder.streamLabel;
this.streamStatus = builder.streamStatus;
this.streamViewType = builder.streamViewType;
this.creationRequestDateTime = builder.creationRequestDateTime;
this.tableName = builder.tableName;
this.keySchema = builder.keySchema;
this.shards = builder.shards;
this.lastEvaluatedShardId = builder.lastEvaluatedShardId;
}
/**
*
* The Amazon Resource Name (ARN) for the stream.
*
*
* @return The Amazon Resource Name (ARN) for the stream.
*/
public String streamArn() {
return streamArn;
}
/**
*
* A timestamp, in ISO 8601 format, for this stream.
*
*
* Note that LatestStreamLabel
is not a unique identifier for the stream, because it is possible that a
* stream from another table might have the same timestamp. However, the combination of the following three elements
* is guaranteed to be unique:
*
*
* -
*
* the AWS customer ID.
*
*
* -
*
* the table name
*
*
* -
*
* the StreamLabel
*
*
*
*
* @return A timestamp, in ISO 8601 format, for this stream.
*
* Note that LatestStreamLabel
is not a unique identifier for the stream, because it is
* possible that a stream from another table might have the same timestamp. However, the combination of the
* following three elements is guaranteed to be unique:
*
*
* -
*
* the AWS customer ID.
*
*
* -
*
* the table name
*
*
* -
*
* the StreamLabel
*
*
*/
public String streamLabel() {
return streamLabel;
}
/**
*
* Indicates the current status of the stream:
*
*
* -
*
* ENABLING
- Streams is currently being enabled on the DynamoDB table.
*
*
* -
*
* ENABLED
- the stream is enabled.
*
*
* -
*
* DISABLING
- Streams is currently being disabled on the DynamoDB table.
*
*
* -
*
* DISABLED
- the stream is disabled.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #streamStatus} will
* return {@link StreamStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #streamStatusAsString}.
*
*
* @return Indicates the current status of the stream:
*
* -
*
* ENABLING
- Streams is currently being enabled on the DynamoDB table.
*
*
* -
*
* ENABLED
- the stream is enabled.
*
*
* -
*
* DISABLING
- Streams is currently being disabled on the DynamoDB table.
*
*
* -
*
* DISABLED
- the stream is disabled.
*
*
* @see StreamStatus
*/
public StreamStatus streamStatus() {
return StreamStatus.fromValue(streamStatus);
}
/**
*
* Indicates the current status of the stream:
*
*
* -
*
* ENABLING
- Streams is currently being enabled on the DynamoDB table.
*
*
* -
*
* ENABLED
- the stream is enabled.
*
*
* -
*
* DISABLING
- Streams is currently being disabled on the DynamoDB table.
*
*
* -
*
* DISABLED
- the stream is disabled.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #streamStatus} will
* return {@link StreamStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #streamStatusAsString}.
*
*
* @return Indicates the current status of the stream:
*
* -
*
* ENABLING
- Streams is currently being enabled on the DynamoDB table.
*
*
* -
*
* ENABLED
- the stream is enabled.
*
*
* -
*
* DISABLING
- Streams is currently being disabled on the DynamoDB table.
*
*
* -
*
* DISABLED
- the stream is disabled.
*
*
* @see StreamStatus
*/
public String streamStatusAsString() {
return streamStatus;
}
/**
*
* Indicates the format of the records within this stream:
*
*
* -
*
* KEYS_ONLY
- only the key attributes of items that were modified in the DynamoDB table.
*
*
* -
*
* NEW_IMAGE
- entire items from the table, as they appeared after they were modified.
*
*
* -
*
* OLD_IMAGE
- entire items from the table, as they appeared before they were modified.
*
*
* -
*
* NEW_AND_OLD_IMAGES
- both the new and the old images of the items from the table.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #streamViewType}
* will return {@link StreamViewType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #streamViewTypeAsString}.
*
*
* @return Indicates the format of the records within this stream:
*
* -
*
* KEYS_ONLY
- only the key attributes of items that were modified in the DynamoDB table.
*
*
* -
*
* NEW_IMAGE
- entire items from the table, as they appeared after they were modified.
*
*
* -
*
* OLD_IMAGE
- entire items from the table, as they appeared before they were modified.
*
*
* -
*
* NEW_AND_OLD_IMAGES
- both the new and the old images of the items from the table.
*
*
* @see StreamViewType
*/
public StreamViewType streamViewType() {
return StreamViewType.fromValue(streamViewType);
}
/**
*
* Indicates the format of the records within this stream:
*
*
* -
*
* KEYS_ONLY
- only the key attributes of items that were modified in the DynamoDB table.
*
*
* -
*
* NEW_IMAGE
- entire items from the table, as they appeared after they were modified.
*
*
* -
*
* OLD_IMAGE
- entire items from the table, as they appeared before they were modified.
*
*
* -
*
* NEW_AND_OLD_IMAGES
- both the new and the old images of the items from the table.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #streamViewType}
* will return {@link StreamViewType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #streamViewTypeAsString}.
*
*
* @return Indicates the format of the records within this stream:
*
* -
*
* KEYS_ONLY
- only the key attributes of items that were modified in the DynamoDB table.
*
*
* -
*
* NEW_IMAGE
- entire items from the table, as they appeared after they were modified.
*
*
* -
*
* OLD_IMAGE
- entire items from the table, as they appeared before they were modified.
*
*
* -
*
* NEW_AND_OLD_IMAGES
- both the new and the old images of the items from the table.
*
*
* @see StreamViewType
*/
public String streamViewTypeAsString() {
return streamViewType;
}
/**
*
* The date and time when the request to create this stream was issued.
*
*
* @return The date and time when the request to create this stream was issued.
*/
public Instant creationRequestDateTime() {
return creationRequestDateTime;
}
/**
*
* The DynamoDB table with which the stream is associated.
*
*
* @return The DynamoDB table with which the stream is associated.
*/
public String tableName() {
return tableName;
}
/**
*
* The key attribute(s) of the stream's DynamoDB table.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* @return The key attribute(s) of the stream's DynamoDB table.
*/
public List keySchema() {
return keySchema;
}
/**
*
* The shards that comprise the stream.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* @return The shards that comprise the stream.
*/
public List shards() {
return shards;
}
/**
*
* The shard ID of the item where the operation stopped, inclusive of the previous result set. Use this value to
* start a new operation, excluding this value in the new request.
*
*
* If LastEvaluatedShardId
is empty, then the "last page" of results has been processed and there is
* currently no more data to be retrieved.
*
*
* If LastEvaluatedShardId
is not empty, it does not necessarily mean that there is more data in the
* result set. The only way to know when you have reached the end of the result set is when
* LastEvaluatedShardId
is empty.
*
*
* @return The shard ID of the item where the operation stopped, inclusive of the previous result set. Use this
* value to start a new operation, excluding this value in the new request.
*
* If LastEvaluatedShardId
is empty, then the "last page" of results has been processed and
* there is currently no more data to be retrieved.
*
*
* If LastEvaluatedShardId
is not empty, it does not necessarily mean that there is more data
* in the result set. The only way to know when you have reached the end of the result set is when
* LastEvaluatedShardId
is empty.
*/
public String lastEvaluatedShardId() {
return lastEvaluatedShardId;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class extends Builder> serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(streamArn());
hashCode = 31 * hashCode + Objects.hashCode(streamLabel());
hashCode = 31 * hashCode + Objects.hashCode(streamStatusAsString());
hashCode = 31 * hashCode + Objects.hashCode(streamViewTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(creationRequestDateTime());
hashCode = 31 * hashCode + Objects.hashCode(tableName());
hashCode = 31 * hashCode + Objects.hashCode(keySchema());
hashCode = 31 * hashCode + Objects.hashCode(shards());
hashCode = 31 * hashCode + Objects.hashCode(lastEvaluatedShardId());
return hashCode;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof StreamDescription)) {
return false;
}
StreamDescription other = (StreamDescription) obj;
return Objects.equals(streamArn(), other.streamArn()) && Objects.equals(streamLabel(), other.streamLabel())
&& Objects.equals(streamStatusAsString(), other.streamStatusAsString())
&& Objects.equals(streamViewTypeAsString(), other.streamViewTypeAsString())
&& Objects.equals(creationRequestDateTime(), other.creationRequestDateTime())
&& Objects.equals(tableName(), other.tableName()) && Objects.equals(keySchema(), other.keySchema())
&& Objects.equals(shards(), other.shards())
&& Objects.equals(lastEvaluatedShardId(), other.lastEvaluatedShardId());
}
@Override
public String toString() {
return ToString.builder("StreamDescription").add("StreamArn", streamArn()).add("StreamLabel", streamLabel())
.add("StreamStatus", streamStatusAsString()).add("StreamViewType", streamViewTypeAsString())
.add("CreationRequestDateTime", creationRequestDateTime()).add("TableName", tableName())
.add("KeySchema", keySchema()).add("Shards", shards()).add("LastEvaluatedShardId", lastEvaluatedShardId())
.build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "StreamArn":
return Optional.ofNullable(clazz.cast(streamArn()));
case "StreamLabel":
return Optional.ofNullable(clazz.cast(streamLabel()));
case "StreamStatus":
return Optional.ofNullable(clazz.cast(streamStatusAsString()));
case "StreamViewType":
return Optional.ofNullable(clazz.cast(streamViewTypeAsString()));
case "CreationRequestDateTime":
return Optional.ofNullable(clazz.cast(creationRequestDateTime()));
case "TableName":
return Optional.ofNullable(clazz.cast(tableName()));
case "KeySchema":
return Optional.ofNullable(clazz.cast(keySchema()));
case "Shards":
return Optional.ofNullable(clazz.cast(shards()));
case "LastEvaluatedShardId":
return Optional.ofNullable(clazz.cast(lastEvaluatedShardId()));
default:
return Optional.empty();
}
}
@SdkInternalApi
@Override
public void marshall(ProtocolMarshaller protocolMarshaller) {
StreamDescriptionMarshaller.getInstance().marshall(this, protocolMarshaller);
}
public interface Builder extends CopyableBuilder {
/**
*
* The Amazon Resource Name (ARN) for the stream.
*
*
* @param streamArn
* The Amazon Resource Name (ARN) for the stream.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder streamArn(String streamArn);
/**
*
* A timestamp, in ISO 8601 format, for this stream.
*
*
* Note that LatestStreamLabel
is not a unique identifier for the stream, because it is possible
* that a stream from another table might have the same timestamp. However, the combination of the following
* three elements is guaranteed to be unique:
*
*
* -
*
* the AWS customer ID.
*
*
* -
*
* the table name
*
*
* -
*
* the StreamLabel
*
*
*
*
* @param streamLabel
* A timestamp, in ISO 8601 format, for this stream.
*
* Note that LatestStreamLabel
is not a unique identifier for the stream, because it is
* possible that a stream from another table might have the same timestamp. However, the combination of
* the following three elements is guaranteed to be unique:
*
*
* -
*
* the AWS customer ID.
*
*
* -
*
* the table name
*
*
* -
*
* the StreamLabel
*
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder streamLabel(String streamLabel);
/**
*
* Indicates the current status of the stream:
*
*
* -
*
* ENABLING
- Streams is currently being enabled on the DynamoDB table.
*
*
* -
*
* ENABLED
- the stream is enabled.
*
*
* -
*
* DISABLING
- Streams is currently being disabled on the DynamoDB table.
*
*
* -
*
* DISABLED
- the stream is disabled.
*
*
*
*
* @param streamStatus
* Indicates the current status of the stream:
*
* -
*
* ENABLING
- Streams is currently being enabled on the DynamoDB table.
*
*
* -
*
* ENABLED
- the stream is enabled.
*
*
* -
*
* DISABLING
- Streams is currently being disabled on the DynamoDB table.
*
*
* -
*
* DISABLED
- the stream is disabled.
*
*
* @see StreamStatus
* @return Returns a reference to this object so that method calls can be chained together.
* @see StreamStatus
*/
Builder streamStatus(String streamStatus);
/**
*
* Indicates the current status of the stream:
*
*
* -
*
* ENABLING
- Streams is currently being enabled on the DynamoDB table.
*
*
* -
*
* ENABLED
- the stream is enabled.
*
*
* -
*
* DISABLING
- Streams is currently being disabled on the DynamoDB table.
*
*
* -
*
* DISABLED
- the stream is disabled.
*
*
*
*
* @param streamStatus
* Indicates the current status of the stream:
*
* -
*
* ENABLING
- Streams is currently being enabled on the DynamoDB table.
*
*
* -
*
* ENABLED
- the stream is enabled.
*
*
* -
*
* DISABLING
- Streams is currently being disabled on the DynamoDB table.
*
*
* -
*
* DISABLED
- the stream is disabled.
*
*
* @see StreamStatus
* @return Returns a reference to this object so that method calls can be chained together.
* @see StreamStatus
*/
Builder streamStatus(StreamStatus streamStatus);
/**
*
* Indicates the format of the records within this stream:
*
*
* -
*
* KEYS_ONLY
- only the key attributes of items that were modified in the DynamoDB table.
*
*
* -
*
* NEW_IMAGE
- entire items from the table, as they appeared after they were modified.
*
*
* -
*
* OLD_IMAGE
- entire items from the table, as they appeared before they were modified.
*
*
* -
*
* NEW_AND_OLD_IMAGES
- both the new and the old images of the items from the table.
*
*
*
*
* @param streamViewType
* Indicates the format of the records within this stream:
*
* -
*
* KEYS_ONLY
- only the key attributes of items that were modified in the DynamoDB table.
*
*
* -
*
* NEW_IMAGE
- entire items from the table, as they appeared after they were modified.
*
*
* -
*
* OLD_IMAGE
- entire items from the table, as they appeared before they were modified.
*
*
* -
*
* NEW_AND_OLD_IMAGES
- both the new and the old images of the items from the table.
*
*
* @see StreamViewType
* @return Returns a reference to this object so that method calls can be chained together.
* @see StreamViewType
*/
Builder streamViewType(String streamViewType);
/**
*
* Indicates the format of the records within this stream:
*
*
* -
*
* KEYS_ONLY
- only the key attributes of items that were modified in the DynamoDB table.
*
*
* -
*
* NEW_IMAGE
- entire items from the table, as they appeared after they were modified.
*
*
* -
*
* OLD_IMAGE
- entire items from the table, as they appeared before they were modified.
*
*
* -
*
* NEW_AND_OLD_IMAGES
- both the new and the old images of the items from the table.
*
*
*
*
* @param streamViewType
* Indicates the format of the records within this stream:
*
* -
*
* KEYS_ONLY
- only the key attributes of items that were modified in the DynamoDB table.
*
*
* -
*
* NEW_IMAGE
- entire items from the table, as they appeared after they were modified.
*
*
* -
*
* OLD_IMAGE
- entire items from the table, as they appeared before they were modified.
*
*
* -
*
* NEW_AND_OLD_IMAGES
- both the new and the old images of the items from the table.
*
*
* @see StreamViewType
* @return Returns a reference to this object so that method calls can be chained together.
* @see StreamViewType
*/
Builder streamViewType(StreamViewType streamViewType);
/**
*
* The date and time when the request to create this stream was issued.
*
*
* @param creationRequestDateTime
* The date and time when the request to create this stream was issued.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder creationRequestDateTime(Instant creationRequestDateTime);
/**
*
* The DynamoDB table with which the stream is associated.
*
*
* @param tableName
* The DynamoDB table with which the stream is associated.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder tableName(String tableName);
/**
*
* The key attribute(s) of the stream's DynamoDB table.
*
*
* @param keySchema
* The key attribute(s) of the stream's DynamoDB table.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder keySchema(Collection keySchema);
/**
*
* The key attribute(s) of the stream's DynamoDB table.
*
*
* @param keySchema
* The key attribute(s) of the stream's DynamoDB table.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder keySchema(KeySchemaElement... keySchema);
/**
*
* The key attribute(s) of the stream's DynamoDB table.
*
* This is a convenience that creates an instance of the {@link List.Builder} avoiding the
* need to create one manually via {@link List#builder()}.
*
* When the {@link Consumer} completes, {@link List.Builder#build()} is called immediately and
* its result is passed to {@link #keySchema(List)}.
*
* @param keySchema
* a consumer that will call methods on {@link List.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #keySchema(List)
*/
Builder keySchema(Consumer... keySchema);
/**
*
* The shards that comprise the stream.
*
*
* @param shards
* The shards that comprise the stream.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder shards(Collection shards);
/**
*
* The shards that comprise the stream.
*
*
* @param shards
* The shards that comprise the stream.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder shards(Shard... shards);
/**
*
* The shards that comprise the stream.
*
* This is a convenience that creates an instance of the {@link List.Builder} avoiding the need to create
* one manually via {@link List#builder()}.
*
* When the {@link Consumer} completes, {@link List.Builder#build()} is called immediately and its result
* is passed to {@link #shards(List)}.
*
* @param shards
* a consumer that will call methods on {@link List.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #shards(List)
*/
Builder shards(Consumer... shards);
/**
*
* The shard ID of the item where the operation stopped, inclusive of the previous result set. Use this value to
* start a new operation, excluding this value in the new request.
*
*
* If LastEvaluatedShardId
is empty, then the "last page" of results has been processed and there
* is currently no more data to be retrieved.
*
*
* If LastEvaluatedShardId
is not empty, it does not necessarily mean that there is more data in
* the result set. The only way to know when you have reached the end of the result set is when
* LastEvaluatedShardId
is empty.
*
*
* @param lastEvaluatedShardId
* The shard ID of the item where the operation stopped, inclusive of the previous result set. Use this
* value to start a new operation, excluding this value in the new request.
*
* If LastEvaluatedShardId
is empty, then the "last page" of results has been processed and
* there is currently no more data to be retrieved.
*
*
* If LastEvaluatedShardId
is not empty, it does not necessarily mean that there is more
* data in the result set. The only way to know when you have reached the end of the result set is when
* LastEvaluatedShardId
is empty.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder lastEvaluatedShardId(String lastEvaluatedShardId);
}
static final class BuilderImpl implements Builder {
private String streamArn;
private String streamLabel;
private String streamStatus;
private String streamViewType;
private Instant creationRequestDateTime;
private String tableName;
private List keySchema = DefaultSdkAutoConstructList.getInstance();
private List shards = DefaultSdkAutoConstructList.getInstance();
private String lastEvaluatedShardId;
private BuilderImpl() {
}
private BuilderImpl(StreamDescription model) {
streamArn(model.streamArn);
streamLabel(model.streamLabel);
streamStatus(model.streamStatus);
streamViewType(model.streamViewType);
creationRequestDateTime(model.creationRequestDateTime);
tableName(model.tableName);
keySchema(model.keySchema);
shards(model.shards);
lastEvaluatedShardId(model.lastEvaluatedShardId);
}
public final String getStreamArn() {
return streamArn;
}
@Override
public final Builder streamArn(String streamArn) {
this.streamArn = streamArn;
return this;
}
public final void setStreamArn(String streamArn) {
this.streamArn = streamArn;
}
public final String getStreamLabel() {
return streamLabel;
}
@Override
public final Builder streamLabel(String streamLabel) {
this.streamLabel = streamLabel;
return this;
}
public final void setStreamLabel(String streamLabel) {
this.streamLabel = streamLabel;
}
public final String getStreamStatus() {
return streamStatus;
}
@Override
public final Builder streamStatus(String streamStatus) {
this.streamStatus = streamStatus;
return this;
}
@Override
public final Builder streamStatus(StreamStatus streamStatus) {
this.streamStatus(streamStatus.toString());
return this;
}
public final void setStreamStatus(String streamStatus) {
this.streamStatus = streamStatus;
}
public final String getStreamViewType() {
return streamViewType;
}
@Override
public final Builder streamViewType(String streamViewType) {
this.streamViewType = streamViewType;
return this;
}
@Override
public final Builder streamViewType(StreamViewType streamViewType) {
this.streamViewType(streamViewType.toString());
return this;
}
public final void setStreamViewType(String streamViewType) {
this.streamViewType = streamViewType;
}
public final Instant getCreationRequestDateTime() {
return creationRequestDateTime;
}
@Override
public final Builder creationRequestDateTime(Instant creationRequestDateTime) {
this.creationRequestDateTime = creationRequestDateTime;
return this;
}
public final void setCreationRequestDateTime(Instant creationRequestDateTime) {
this.creationRequestDateTime = creationRequestDateTime;
}
public final String getTableName() {
return tableName;
}
@Override
public final Builder tableName(String tableName) {
this.tableName = tableName;
return this;
}
public final void setTableName(String tableName) {
this.tableName = tableName;
}
public final Collection getKeySchema() {
return keySchema != null ? keySchema.stream().map(KeySchemaElement::toBuilder).collect(Collectors.toList()) : null;
}
@Override
public final Builder keySchema(Collection keySchema) {
this.keySchema = KeySchemaCopier.copy(keySchema);
return this;
}
@Override
@SafeVarargs
public final Builder keySchema(KeySchemaElement... keySchema) {
keySchema(Arrays.asList(keySchema));
return this;
}
@Override
@SafeVarargs
public final Builder keySchema(Consumer... keySchema) {
keySchema(Stream.of(keySchema).map(c -> KeySchemaElement.builder().applyMutation(c).build())
.collect(Collectors.toList()));
return this;
}
public final void setKeySchema(Collection keySchema) {
this.keySchema = KeySchemaCopier.copyFromBuilder(keySchema);
}
public final Collection getShards() {
return shards != null ? shards.stream().map(Shard::toBuilder).collect(Collectors.toList()) : null;
}
@Override
public final Builder shards(Collection shards) {
this.shards = ShardDescriptionListCopier.copy(shards);
return this;
}
@Override
@SafeVarargs
public final Builder shards(Shard... shards) {
shards(Arrays.asList(shards));
return this;
}
@Override
@SafeVarargs
public final Builder shards(Consumer... shards) {
shards(Stream.of(shards).map(c -> Shard.builder().applyMutation(c).build()).collect(Collectors.toList()));
return this;
}
public final void setShards(Collection shards) {
this.shards = ShardDescriptionListCopier.copyFromBuilder(shards);
}
public final String getLastEvaluatedShardId() {
return lastEvaluatedShardId;
}
@Override
public final Builder lastEvaluatedShardId(String lastEvaluatedShardId) {
this.lastEvaluatedShardId = lastEvaluatedShardId;
return this;
}
public final void setLastEvaluatedShardId(String lastEvaluatedShardId) {
this.lastEvaluatedShardId = lastEvaluatedShardId;
}
@Override
public StreamDescription build() {
return new StreamDescription(this);
}
}
}