
software.amazon.awssdk.services.kinesis.model.HashKeyRange Maven / Gradle / Ivy
Go to download
A single bundled dependency that includes all service and dependent JARs with third-party libraries
relocated to different namespaces.
/*
* 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.kinesis.model;
import java.util.Objects;
import java.util.Optional;
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.services.kinesis.transform.HashKeyRangeMarshaller;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* The range of possible hash key values for the shard, which is a set of ordered contiguous positive integers.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class HashKeyRange implements StructuredPojo, ToCopyableBuilder {
private final String startingHashKey;
private final String endingHashKey;
private HashKeyRange(BuilderImpl builder) {
this.startingHashKey = builder.startingHashKey;
this.endingHashKey = builder.endingHashKey;
}
/**
*
* The starting hash key of the hash key range.
*
*
* @return The starting hash key of the hash key range.
*/
public String startingHashKey() {
return startingHashKey;
}
/**
*
* The ending hash key of the hash key range.
*
*
* @return The ending hash key of the hash key range.
*/
public String endingHashKey() {
return endingHashKey;
}
@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(startingHashKey());
hashCode = 31 * hashCode + Objects.hashCode(endingHashKey());
return hashCode;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof HashKeyRange)) {
return false;
}
HashKeyRange other = (HashKeyRange) obj;
return Objects.equals(startingHashKey(), other.startingHashKey())
&& Objects.equals(endingHashKey(), other.endingHashKey());
}
@Override
public String toString() {
return ToString.builder("HashKeyRange").add("StartingHashKey", startingHashKey()).add("EndingHashKey", endingHashKey())
.build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "StartingHashKey":
return Optional.ofNullable(clazz.cast(startingHashKey()));
case "EndingHashKey":
return Optional.ofNullable(clazz.cast(endingHashKey()));
default:
return Optional.empty();
}
}
@SdkInternalApi
@Override
public void marshall(ProtocolMarshaller protocolMarshaller) {
HashKeyRangeMarshaller.getInstance().marshall(this, protocolMarshaller);
}
public interface Builder extends CopyableBuilder {
/**
*
* The starting hash key of the hash key range.
*
*
* @param startingHashKey
* The starting hash key of the hash key range.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder startingHashKey(String startingHashKey);
/**
*
* The ending hash key of the hash key range.
*
*
* @param endingHashKey
* The ending hash key of the hash key range.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder endingHashKey(String endingHashKey);
}
static final class BuilderImpl implements Builder {
private String startingHashKey;
private String endingHashKey;
private BuilderImpl() {
}
private BuilderImpl(HashKeyRange model) {
startingHashKey(model.startingHashKey);
endingHashKey(model.endingHashKey);
}
public final String getStartingHashKey() {
return startingHashKey;
}
@Override
public final Builder startingHashKey(String startingHashKey) {
this.startingHashKey = startingHashKey;
return this;
}
public final void setStartingHashKey(String startingHashKey) {
this.startingHashKey = startingHashKey;
}
public final String getEndingHashKey() {
return endingHashKey;
}
@Override
public final Builder endingHashKey(String endingHashKey) {
this.endingHashKey = endingHashKey;
return this;
}
public final void setEndingHashKey(String endingHashKey) {
this.endingHashKey = endingHashKey;
}
@Override
public HashKeyRange build() {
return new HashKeyRange(this);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy