software.amazon.awssdk.services.databasemigration.model.SchemaResponse Maven / Gradle / Ivy
Show all versions of databasemigration Show documentation
/*
* 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.databasemigration.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.Consumer;
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;
/**
*
* Describes a schema in a Fleet Advisor collector inventory.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class SchemaResponse implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField CODE_LINE_COUNT_FIELD = SdkField. builder(MarshallingType.LONG)
.memberName("CodeLineCount").getter(getter(SchemaResponse::codeLineCount)).setter(setter(Builder::codeLineCount))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CodeLineCount").build()).build();
private static final SdkField CODE_SIZE_FIELD = SdkField. builder(MarshallingType.LONG).memberName("CodeSize")
.getter(getter(SchemaResponse::codeSize)).setter(setter(Builder::codeSize))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CodeSize").build()).build();
private static final SdkField COMPLEXITY_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("Complexity").getter(getter(SchemaResponse::complexity)).setter(setter(Builder::complexity))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Complexity").build()).build();
private static final SdkField SERVER_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("Server")
.getter(getter(SchemaResponse::server)).setter(setter(Builder::server)).constructor(ServerShortInfoResponse::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Server").build()).build();
private static final SdkField DATABASE_INSTANCE_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("DatabaseInstance")
.getter(getter(SchemaResponse::databaseInstance)).setter(setter(Builder::databaseInstance))
.constructor(DatabaseShortInfoResponse::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DatabaseInstance").build()).build();
private static final SdkField SCHEMA_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("SchemaId").getter(getter(SchemaResponse::schemaId)).setter(setter(Builder::schemaId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SchemaId").build()).build();
private static final SdkField SCHEMA_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("SchemaName").getter(getter(SchemaResponse::schemaName)).setter(setter(Builder::schemaName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SchemaName").build()).build();
private static final SdkField ORIGINAL_SCHEMA_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("OriginalSchema")
.getter(getter(SchemaResponse::originalSchema)).setter(setter(Builder::originalSchema))
.constructor(SchemaShortInfoResponse::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("OriginalSchema").build()).build();
private static final SdkField SIMILARITY_FIELD = SdkField. builder(MarshallingType.DOUBLE)
.memberName("Similarity").getter(getter(SchemaResponse::similarity)).setter(setter(Builder::similarity))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Similarity").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(CODE_LINE_COUNT_FIELD,
CODE_SIZE_FIELD, COMPLEXITY_FIELD, SERVER_FIELD, DATABASE_INSTANCE_FIELD, SCHEMA_ID_FIELD, SCHEMA_NAME_FIELD,
ORIGINAL_SCHEMA_FIELD, SIMILARITY_FIELD));
private static final long serialVersionUID = 1L;
private final Long codeLineCount;
private final Long codeSize;
private final String complexity;
private final ServerShortInfoResponse server;
private final DatabaseShortInfoResponse databaseInstance;
private final String schemaId;
private final String schemaName;
private final SchemaShortInfoResponse originalSchema;
private final Double similarity;
private SchemaResponse(BuilderImpl builder) {
this.codeLineCount = builder.codeLineCount;
this.codeSize = builder.codeSize;
this.complexity = builder.complexity;
this.server = builder.server;
this.databaseInstance = builder.databaseInstance;
this.schemaId = builder.schemaId;
this.schemaName = builder.schemaName;
this.originalSchema = builder.originalSchema;
this.similarity = builder.similarity;
}
/**
*
* The number of lines of code in a schema in a Fleet Advisor collector inventory.
*
*
* @return The number of lines of code in a schema in a Fleet Advisor collector inventory.
*/
public final Long codeLineCount() {
return codeLineCount;
}
/**
*
* The size level of the code in a schema in a Fleet Advisor collector inventory.
*
*
* @return The size level of the code in a schema in a Fleet Advisor collector inventory.
*/
public final Long codeSize() {
return codeSize;
}
/**
*
* The complexity level of the code in a schema in a Fleet Advisor collector inventory.
*
*
* @return The complexity level of the code in a schema in a Fleet Advisor collector inventory.
*/
public final String complexity() {
return complexity;
}
/**
*
* The database server for a schema in a Fleet Advisor collector inventory.
*
*
* @return The database server for a schema in a Fleet Advisor collector inventory.
*/
public final ServerShortInfoResponse server() {
return server;
}
/**
*
* The database for a schema in a Fleet Advisor collector inventory.
*
*
* @return The database for a schema in a Fleet Advisor collector inventory.
*/
public final DatabaseShortInfoResponse databaseInstance() {
return databaseInstance;
}
/**
*
* The ID of a schema in a Fleet Advisor collector inventory.
*
*
* @return The ID of a schema in a Fleet Advisor collector inventory.
*/
public final String schemaId() {
return schemaId;
}
/**
*
* The name of a schema in a Fleet Advisor collector inventory.
*
*
* @return The name of a schema in a Fleet Advisor collector inventory.
*/
public final String schemaName() {
return schemaName;
}
/**
* Returns the value of the OriginalSchema property for this object.
*
* @return The value of the OriginalSchema property for this object.
*/
public final SchemaShortInfoResponse originalSchema() {
return originalSchema;
}
/**
*
* The similarity value for a schema in a Fleet Advisor collector inventory. A higher similarity value indicates
* that a schema is likely to be a duplicate.
*
*
* @return The similarity value for a schema in a Fleet Advisor collector inventory. A higher similarity value
* indicates that a schema is likely to be a duplicate.
*/
public final Double similarity() {
return similarity;
}
@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(codeLineCount());
hashCode = 31 * hashCode + Objects.hashCode(codeSize());
hashCode = 31 * hashCode + Objects.hashCode(complexity());
hashCode = 31 * hashCode + Objects.hashCode(server());
hashCode = 31 * hashCode + Objects.hashCode(databaseInstance());
hashCode = 31 * hashCode + Objects.hashCode(schemaId());
hashCode = 31 * hashCode + Objects.hashCode(schemaName());
hashCode = 31 * hashCode + Objects.hashCode(originalSchema());
hashCode = 31 * hashCode + Objects.hashCode(similarity());
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 SchemaResponse)) {
return false;
}
SchemaResponse other = (SchemaResponse) obj;
return Objects.equals(codeLineCount(), other.codeLineCount()) && Objects.equals(codeSize(), other.codeSize())
&& Objects.equals(complexity(), other.complexity()) && Objects.equals(server(), other.server())
&& Objects.equals(databaseInstance(), other.databaseInstance()) && Objects.equals(schemaId(), other.schemaId())
&& Objects.equals(schemaName(), other.schemaName()) && Objects.equals(originalSchema(), other.originalSchema())
&& Objects.equals(similarity(), other.similarity());
}
/**
* 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("SchemaResponse").add("CodeLineCount", codeLineCount()).add("CodeSize", codeSize())
.add("Complexity", complexity()).add("Server", server()).add("DatabaseInstance", databaseInstance())
.add("SchemaId", schemaId()).add("SchemaName", schemaName()).add("OriginalSchema", originalSchema())
.add("Similarity", similarity()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "CodeLineCount":
return Optional.ofNullable(clazz.cast(codeLineCount()));
case "CodeSize":
return Optional.ofNullable(clazz.cast(codeSize()));
case "Complexity":
return Optional.ofNullable(clazz.cast(complexity()));
case "Server":
return Optional.ofNullable(clazz.cast(server()));
case "DatabaseInstance":
return Optional.ofNullable(clazz.cast(databaseInstance()));
case "SchemaId":
return Optional.ofNullable(clazz.cast(schemaId()));
case "SchemaName":
return Optional.ofNullable(clazz.cast(schemaName()));
case "OriginalSchema":
return Optional.ofNullable(clazz.cast(originalSchema()));
case "Similarity":
return Optional.ofNullable(clazz.cast(similarity()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function