software.amazon.awssdk.services.translate.model.JobDetails Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of translate Show documentation
Show all versions of translate Show documentation
The AWS Java SDK for Amazon Translate module holds the client classes that are used for communicating
with Amazon Translate Service
/*
* 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.translate.model;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
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;
/**
*
* The number of documents successfully and unsuccessfully processed during a translation job.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class JobDetails implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField TRANSLATED_DOCUMENTS_COUNT_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("TranslatedDocumentsCount").getter(getter(JobDetails::translatedDocumentsCount))
.setter(setter(Builder::translatedDocumentsCount))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TranslatedDocumentsCount").build())
.build();
private static final SdkField DOCUMENTS_WITH_ERRORS_COUNT_FIELD = SdkField
. builder(MarshallingType.INTEGER).memberName("DocumentsWithErrorsCount")
.getter(getter(JobDetails::documentsWithErrorsCount)).setter(setter(Builder::documentsWithErrorsCount))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DocumentsWithErrorsCount").build())
.build();
private static final SdkField INPUT_DOCUMENTS_COUNT_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("InputDocumentsCount").getter(getter(JobDetails::inputDocumentsCount))
.setter(setter(Builder::inputDocumentsCount))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("InputDocumentsCount").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(
TRANSLATED_DOCUMENTS_COUNT_FIELD, DOCUMENTS_WITH_ERRORS_COUNT_FIELD, INPUT_DOCUMENTS_COUNT_FIELD));
private static final Map> SDK_NAME_TO_FIELD = memberNameToFieldInitializer();
private static final long serialVersionUID = 1L;
private final Integer translatedDocumentsCount;
private final Integer documentsWithErrorsCount;
private final Integer inputDocumentsCount;
private JobDetails(BuilderImpl builder) {
this.translatedDocumentsCount = builder.translatedDocumentsCount;
this.documentsWithErrorsCount = builder.documentsWithErrorsCount;
this.inputDocumentsCount = builder.inputDocumentsCount;
}
/**
*
* The number of documents successfully processed during a translation job.
*
*
* @return The number of documents successfully processed during a translation job.
*/
public final Integer translatedDocumentsCount() {
return translatedDocumentsCount;
}
/**
*
* The number of documents that could not be processed during a translation job.
*
*
* @return The number of documents that could not be processed during a translation job.
*/
public final Integer documentsWithErrorsCount() {
return documentsWithErrorsCount;
}
/**
*
* The number of documents used as input in a translation job.
*
*
* @return The number of documents used as input in a translation job.
*/
public final Integer inputDocumentsCount() {
return inputDocumentsCount;
}
@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(translatedDocumentsCount());
hashCode = 31 * hashCode + Objects.hashCode(documentsWithErrorsCount());
hashCode = 31 * hashCode + Objects.hashCode(inputDocumentsCount());
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 JobDetails)) {
return false;
}
JobDetails other = (JobDetails) obj;
return Objects.equals(translatedDocumentsCount(), other.translatedDocumentsCount())
&& Objects.equals(documentsWithErrorsCount(), other.documentsWithErrorsCount())
&& Objects.equals(inputDocumentsCount(), other.inputDocumentsCount());
}
/**
* 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("JobDetails").add("TranslatedDocumentsCount", translatedDocumentsCount())
.add("DocumentsWithErrorsCount", documentsWithErrorsCount()).add("InputDocumentsCount", inputDocumentsCount())
.build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "TranslatedDocumentsCount":
return Optional.ofNullable(clazz.cast(translatedDocumentsCount()));
case "DocumentsWithErrorsCount":
return Optional.ofNullable(clazz.cast(documentsWithErrorsCount()));
case "InputDocumentsCount":
return Optional.ofNullable(clazz.cast(inputDocumentsCount()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
@Override
public final Map> sdkFieldNameToField() {
return SDK_NAME_TO_FIELD;
}
private static Map> memberNameToFieldInitializer() {
Map> map = new HashMap<>();
map.put("TranslatedDocumentsCount", TRANSLATED_DOCUMENTS_COUNT_FIELD);
map.put("DocumentsWithErrorsCount", DOCUMENTS_WITH_ERRORS_COUNT_FIELD);
map.put("InputDocumentsCount", INPUT_DOCUMENTS_COUNT_FIELD);
return Collections.unmodifiableMap(map);
}
private static Function
© 2015 - 2025 Weber Informatics LLC | Privacy Policy