
software.amazon.awssdk.services.s3.model.Progress Maven / Gradle / Ivy
/*
* Copyright 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.s3.model;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Function;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.core.SdkField;
import software.amazon.awssdk.core.SdkPojo;
import software.amazon.awssdk.core.protocol.MarshallLocation;
import software.amazon.awssdk.core.protocol.MarshallingType;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* This data type contains information about progress of an operation.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class Progress implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField BYTES_SCANNED_FIELD = SdkField
. builder(MarshallingType.LONG)
.memberName("BytesScanned")
.getter(getter(Progress::bytesScanned))
.setter(setter(Builder::bytesScanned))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("BytesScanned")
.unmarshallLocationName("BytesScanned").build()).build();
private static final SdkField BYTES_PROCESSED_FIELD = SdkField
. builder(MarshallingType.LONG)
.memberName("BytesProcessed")
.getter(getter(Progress::bytesProcessed))
.setter(setter(Builder::bytesProcessed))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("BytesProcessed")
.unmarshallLocationName("BytesProcessed").build()).build();
private static final SdkField BYTES_RETURNED_FIELD = SdkField
. builder(MarshallingType.LONG)
.memberName("BytesReturned")
.getter(getter(Progress::bytesReturned))
.setter(setter(Builder::bytesReturned))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("BytesReturned")
.unmarshallLocationName("BytesReturned").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(BYTES_SCANNED_FIELD,
BYTES_PROCESSED_FIELD, BYTES_RETURNED_FIELD));
private static final long serialVersionUID = 1L;
private final Long bytesScanned;
private final Long bytesProcessed;
private final Long bytesReturned;
private Progress(BuilderImpl builder) {
this.bytesScanned = builder.bytesScanned;
this.bytesProcessed = builder.bytesProcessed;
this.bytesReturned = builder.bytesReturned;
}
/**
*
* The current number of object bytes scanned.
*
*
* @return The current number of object bytes scanned.
*/
public final Long bytesScanned() {
return bytesScanned;
}
/**
*
* The current number of uncompressed object bytes processed.
*
*
* @return The current number of uncompressed object bytes processed.
*/
public final Long bytesProcessed() {
return bytesProcessed;
}
/**
*
* The current number of bytes of records payload data returned.
*
*
* @return The current number of bytes of records payload data returned.
*/
public final Long bytesReturned() {
return bytesReturned;
}
@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 final int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(bytesScanned());
hashCode = 31 * hashCode + Objects.hashCode(bytesProcessed());
hashCode = 31 * hashCode + Objects.hashCode(bytesReturned());
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof Progress)) {
return false;
}
Progress other = (Progress) obj;
return Objects.equals(bytesScanned(), other.bytesScanned()) && Objects.equals(bytesProcessed(), other.bytesProcessed())
&& Objects.equals(bytesReturned(), other.bytesReturned());
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*/
@Override
public final String toString() {
return ToString.builder("Progress").add("BytesScanned", bytesScanned()).add("BytesProcessed", bytesProcessed())
.add("BytesReturned", bytesReturned()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "BytesScanned":
return Optional.ofNullable(clazz.cast(bytesScanned()));
case "BytesProcessed":
return Optional.ofNullable(clazz.cast(bytesProcessed()));
case "BytesReturned":
return Optional.ofNullable(clazz.cast(bytesReturned()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function
© 2015 - 2025 Weber Informatics LLC | Privacy Policy