software.amazon.awssdk.services.codebuild.model.CodeCoverageReportSummary Maven / Gradle / Ivy
Show all versions of codebuild 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.codebuild.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;
/**
*
* Contains a summary of a code coverage report.
*
*
* Line coverage measures how many statements your tests cover. A statement is a single instruction, not including
* comments, conditionals, etc.
*
*
* Branch coverage determines if your tests cover every possible branch of a control structure, such as an
* if
or case
statement.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class CodeCoverageReportSummary implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField LINE_COVERAGE_PERCENTAGE_FIELD = SdkField. builder(MarshallingType.DOUBLE)
.memberName("lineCoveragePercentage").getter(getter(CodeCoverageReportSummary::lineCoveragePercentage))
.setter(setter(Builder::lineCoveragePercentage))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("lineCoveragePercentage").build())
.build();
private static final SdkField LINES_COVERED_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("linesCovered").getter(getter(CodeCoverageReportSummary::linesCovered))
.setter(setter(Builder::linesCovered))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("linesCovered").build()).build();
private static final SdkField LINES_MISSED_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("linesMissed").getter(getter(CodeCoverageReportSummary::linesMissed))
.setter(setter(Builder::linesMissed))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("linesMissed").build()).build();
private static final SdkField BRANCH_COVERAGE_PERCENTAGE_FIELD = SdkField. builder(MarshallingType.DOUBLE)
.memberName("branchCoveragePercentage").getter(getter(CodeCoverageReportSummary::branchCoveragePercentage))
.setter(setter(Builder::branchCoveragePercentage))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("branchCoveragePercentage").build())
.build();
private static final SdkField BRANCHES_COVERED_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("branchesCovered").getter(getter(CodeCoverageReportSummary::branchesCovered))
.setter(setter(Builder::branchesCovered))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("branchesCovered").build()).build();
private static final SdkField BRANCHES_MISSED_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("branchesMissed").getter(getter(CodeCoverageReportSummary::branchesMissed))
.setter(setter(Builder::branchesMissed))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("branchesMissed").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(
LINE_COVERAGE_PERCENTAGE_FIELD, LINES_COVERED_FIELD, LINES_MISSED_FIELD, BRANCH_COVERAGE_PERCENTAGE_FIELD,
BRANCHES_COVERED_FIELD, BRANCHES_MISSED_FIELD));
private static final long serialVersionUID = 1L;
private final Double lineCoveragePercentage;
private final Integer linesCovered;
private final Integer linesMissed;
private final Double branchCoveragePercentage;
private final Integer branchesCovered;
private final Integer branchesMissed;
private CodeCoverageReportSummary(BuilderImpl builder) {
this.lineCoveragePercentage = builder.lineCoveragePercentage;
this.linesCovered = builder.linesCovered;
this.linesMissed = builder.linesMissed;
this.branchCoveragePercentage = builder.branchCoveragePercentage;
this.branchesCovered = builder.branchesCovered;
this.branchesMissed = builder.branchesMissed;
}
/**
*
* The percentage of lines that are covered by your tests.
*
*
* @return The percentage of lines that are covered by your tests.
*/
public final Double lineCoveragePercentage() {
return lineCoveragePercentage;
}
/**
*
* The number of lines that are covered by your tests.
*
*
* @return The number of lines that are covered by your tests.
*/
public final Integer linesCovered() {
return linesCovered;
}
/**
*
* The number of lines that are not covered by your tests.
*
*
* @return The number of lines that are not covered by your tests.
*/
public final Integer linesMissed() {
return linesMissed;
}
/**
*
* The percentage of branches that are covered by your tests.
*
*
* @return The percentage of branches that are covered by your tests.
*/
public final Double branchCoveragePercentage() {
return branchCoveragePercentage;
}
/**
*
* The number of conditional branches that are covered by your tests.
*
*
* @return The number of conditional branches that are covered by your tests.
*/
public final Integer branchesCovered() {
return branchesCovered;
}
/**
*
* The number of conditional branches that are not covered by your tests.
*
*
* @return The number of conditional branches that are not covered by your tests.
*/
public final Integer branchesMissed() {
return branchesMissed;
}
@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(lineCoveragePercentage());
hashCode = 31 * hashCode + Objects.hashCode(linesCovered());
hashCode = 31 * hashCode + Objects.hashCode(linesMissed());
hashCode = 31 * hashCode + Objects.hashCode(branchCoveragePercentage());
hashCode = 31 * hashCode + Objects.hashCode(branchesCovered());
hashCode = 31 * hashCode + Objects.hashCode(branchesMissed());
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 CodeCoverageReportSummary)) {
return false;
}
CodeCoverageReportSummary other = (CodeCoverageReportSummary) obj;
return Objects.equals(lineCoveragePercentage(), other.lineCoveragePercentage())
&& Objects.equals(linesCovered(), other.linesCovered()) && Objects.equals(linesMissed(), other.linesMissed())
&& Objects.equals(branchCoveragePercentage(), other.branchCoveragePercentage())
&& Objects.equals(branchesCovered(), other.branchesCovered())
&& Objects.equals(branchesMissed(), other.branchesMissed());
}
/**
* 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("CodeCoverageReportSummary").add("LineCoveragePercentage", lineCoveragePercentage())
.add("LinesCovered", linesCovered()).add("LinesMissed", linesMissed())
.add("BranchCoveragePercentage", branchCoveragePercentage()).add("BranchesCovered", branchesCovered())
.add("BranchesMissed", branchesMissed()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "lineCoveragePercentage":
return Optional.ofNullable(clazz.cast(lineCoveragePercentage()));
case "linesCovered":
return Optional.ofNullable(clazz.cast(linesCovered()));
case "linesMissed":
return Optional.ofNullable(clazz.cast(linesMissed()));
case "branchCoveragePercentage":
return Optional.ofNullable(clazz.cast(branchCoveragePercentage()));
case "branchesCovered":
return Optional.ofNullable(clazz.cast(branchesCovered()));
case "branchesMissed":
return Optional.ofNullable(clazz.cast(branchesMissed()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function