software.amazon.awssdk.services.codegurureviewer.model.RecommendationSummary Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of codegurureviewer Show documentation
Show all versions of codegurureviewer Show documentation
The AWS Java SDK for CodeGuru Reviewer module holds the client classes that are used for
communicating with CodeGuru Reviewer.
/*
* 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.codegurureviewer.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;
/**
*
* Information about recommendations.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class RecommendationSummary implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField FILE_PATH_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("FilePath").getter(getter(RecommendationSummary::filePath)).setter(setter(Builder::filePath))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("FilePath").build()).build();
private static final SdkField RECOMMENDATION_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("RecommendationId").getter(getter(RecommendationSummary::recommendationId))
.setter(setter(Builder::recommendationId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RecommendationId").build()).build();
private static final SdkField START_LINE_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("StartLine").getter(getter(RecommendationSummary::startLine)).setter(setter(Builder::startLine))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StartLine").build()).build();
private static final SdkField END_LINE_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("EndLine").getter(getter(RecommendationSummary::endLine)).setter(setter(Builder::endLine))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EndLine").build()).build();
private static final SdkField DESCRIPTION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("Description").getter(getter(RecommendationSummary::description)).setter(setter(Builder::description))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Description").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(FILE_PATH_FIELD,
RECOMMENDATION_ID_FIELD, START_LINE_FIELD, END_LINE_FIELD, DESCRIPTION_FIELD));
private static final long serialVersionUID = 1L;
private final String filePath;
private final String recommendationId;
private final Integer startLine;
private final Integer endLine;
private final String description;
private RecommendationSummary(BuilderImpl builder) {
this.filePath = builder.filePath;
this.recommendationId = builder.recommendationId;
this.startLine = builder.startLine;
this.endLine = builder.endLine;
this.description = builder.description;
}
/**
*
* Name of the file on which a recommendation is provided.
*
*
* @return Name of the file on which a recommendation is provided.
*/
public final String filePath() {
return filePath;
}
/**
*
* The recommendation ID that can be used to track the provided recommendations. Later on it can be used to collect
* the feedback.
*
*
* @return The recommendation ID that can be used to track the provided recommendations. Later on it can be used to
* collect the feedback.
*/
public final String recommendationId() {
return recommendationId;
}
/**
*
* Start line from where the recommendation is applicable in the source commit or source branch.
*
*
* @return Start line from where the recommendation is applicable in the source commit or source branch.
*/
public final Integer startLine() {
return startLine;
}
/**
*
* Last line where the recommendation is applicable in the source commit or source branch. For a single line comment
* the start line and end line values are the same.
*
*
* @return Last line where the recommendation is applicable in the source commit or source branch. For a single line
* comment the start line and end line values are the same.
*/
public final Integer endLine() {
return endLine;
}
/**
*
* A description of the recommendation generated by CodeGuru Reviewer for the lines of code between the start line
* and the end line.
*
*
* @return A description of the recommendation generated by CodeGuru Reviewer for the lines of code between the
* start line and the end line.
*/
public final String description() {
return description;
}
@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(filePath());
hashCode = 31 * hashCode + Objects.hashCode(recommendationId());
hashCode = 31 * hashCode + Objects.hashCode(startLine());
hashCode = 31 * hashCode + Objects.hashCode(endLine());
hashCode = 31 * hashCode + Objects.hashCode(description());
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 RecommendationSummary)) {
return false;
}
RecommendationSummary other = (RecommendationSummary) obj;
return Objects.equals(filePath(), other.filePath()) && Objects.equals(recommendationId(), other.recommendationId())
&& Objects.equals(startLine(), other.startLine()) && Objects.equals(endLine(), other.endLine())
&& Objects.equals(description(), other.description());
}
/**
* 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("RecommendationSummary").add("FilePath", filePath()).add("RecommendationId", recommendationId())
.add("StartLine", startLine()).add("EndLine", endLine()).add("Description", description()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "FilePath":
return Optional.ofNullable(clazz.cast(filePath()));
case "RecommendationId":
return Optional.ofNullable(clazz.cast(recommendationId()));
case "StartLine":
return Optional.ofNullable(clazz.cast(startLine()));
case "EndLine":
return Optional.ofNullable(clazz.cast(endLine()));
case "Description":
return Optional.ofNullable(clazz.cast(description()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function
© 2015 - 2025 Weber Informatics LLC | Privacy Policy