All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awssdk.services.forecast.model.WindowSummary Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Forecast module holds the client classes that are used for communicating with Forecast.

There is a newer version: 2.29.15
Show newest version
/*
 * 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.forecast.model;

import java.io.Serializable;
import java.time.Instant;
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;

/**
 * 

* The metrics for a time range within the evaluation portion of a dataset. This object is part of the * EvaluationResult object. *

*

* The TestWindowStart and TestWindowEnd parameters are determined by the * BackTestWindowOffset parameter of the EvaluationParameters object. *

*/ @Generated("software.amazon.awssdk:codegen") public final class WindowSummary implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField TEST_WINDOW_START_FIELD = SdkField. builder(MarshallingType.INSTANT) .memberName("TestWindowStart").getter(getter(WindowSummary::testWindowStart)) .setter(setter(Builder::testWindowStart)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TestWindowStart").build()).build(); private static final SdkField TEST_WINDOW_END_FIELD = SdkField. builder(MarshallingType.INSTANT) .memberName("TestWindowEnd").getter(getter(WindowSummary::testWindowEnd)).setter(setter(Builder::testWindowEnd)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TestWindowEnd").build()).build(); private static final SdkField ITEM_COUNT_FIELD = SdkField. builder(MarshallingType.INTEGER) .memberName("ItemCount").getter(getter(WindowSummary::itemCount)).setter(setter(Builder::itemCount)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ItemCount").build()).build(); private static final SdkField EVALUATION_TYPE_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("EvaluationType").getter(getter(WindowSummary::evaluationTypeAsString)) .setter(setter(Builder::evaluationType)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EvaluationType").build()).build(); private static final SdkField METRICS_FIELD = SdkField. builder(MarshallingType.SDK_POJO) .memberName("Metrics").getter(getter(WindowSummary::metrics)).setter(setter(Builder::metrics)) .constructor(Metrics::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Metrics").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(TEST_WINDOW_START_FIELD, TEST_WINDOW_END_FIELD, ITEM_COUNT_FIELD, EVALUATION_TYPE_FIELD, METRICS_FIELD)); private static final long serialVersionUID = 1L; private final Instant testWindowStart; private final Instant testWindowEnd; private final Integer itemCount; private final String evaluationType; private final Metrics metrics; private WindowSummary(BuilderImpl builder) { this.testWindowStart = builder.testWindowStart; this.testWindowEnd = builder.testWindowEnd; this.itemCount = builder.itemCount; this.evaluationType = builder.evaluationType; this.metrics = builder.metrics; } /** *

* The timestamp that defines the start of the window. *

* * @return The timestamp that defines the start of the window. */ public final Instant testWindowStart() { return testWindowStart; } /** *

* The timestamp that defines the end of the window. *

* * @return The timestamp that defines the end of the window. */ public final Instant testWindowEnd() { return testWindowEnd; } /** *

* The number of data points within the window. *

* * @return The number of data points within the window. */ public final Integer itemCount() { return itemCount; } /** *

* The type of evaluation. *

*
    *
  • *

    * SUMMARY - The average metrics across all windows. *

    *
  • *
  • *

    * COMPUTED - The metrics for the specified window. *

    *
  • *
*

* If the service returns an enum value that is not available in the current SDK version, {@link #evaluationType} * will return {@link EvaluationType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available * from {@link #evaluationTypeAsString}. *

* * @return The type of evaluation.

*
    *
  • *

    * SUMMARY - The average metrics across all windows. *

    *
  • *
  • *

    * COMPUTED - The metrics for the specified window. *

    *
  • * @see EvaluationType */ public final EvaluationType evaluationType() { return EvaluationType.fromValue(evaluationType); } /** *

    * The type of evaluation. *

    *
      *
    • *

      * SUMMARY - The average metrics across all windows. *

      *
    • *
    • *

      * COMPUTED - The metrics for the specified window. *

      *
    • *
    *

    * If the service returns an enum value that is not available in the current SDK version, {@link #evaluationType} * will return {@link EvaluationType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available * from {@link #evaluationTypeAsString}. *

    * * @return The type of evaluation.

    *
      *
    • *

      * SUMMARY - The average metrics across all windows. *

      *
    • *
    • *

      * COMPUTED - The metrics for the specified window. *

      *
    • * @see EvaluationType */ public final String evaluationTypeAsString() { return evaluationType; } /** *

      * Provides metrics used to evaluate the performance of a predictor. *

      * * @return Provides metrics used to evaluate the performance of a predictor. */ public final Metrics metrics() { return metrics; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public final int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(testWindowStart()); hashCode = 31 * hashCode + Objects.hashCode(testWindowEnd()); hashCode = 31 * hashCode + Objects.hashCode(itemCount()); hashCode = 31 * hashCode + Objects.hashCode(evaluationTypeAsString()); hashCode = 31 * hashCode + Objects.hashCode(metrics()); 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 WindowSummary)) { return false; } WindowSummary other = (WindowSummary) obj; return Objects.equals(testWindowStart(), other.testWindowStart()) && Objects.equals(testWindowEnd(), other.testWindowEnd()) && Objects.equals(itemCount(), other.itemCount()) && Objects.equals(evaluationTypeAsString(), other.evaluationTypeAsString()) && Objects.equals(metrics(), other.metrics()); } /** * 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("WindowSummary").add("TestWindowStart", testWindowStart()).add("TestWindowEnd", testWindowEnd()) .add("ItemCount", itemCount()).add("EvaluationType", evaluationTypeAsString()).add("Metrics", metrics()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "TestWindowStart": return Optional.ofNullable(clazz.cast(testWindowStart())); case "TestWindowEnd": return Optional.ofNullable(clazz.cast(testWindowEnd())); case "ItemCount": return Optional.ofNullable(clazz.cast(itemCount())); case "EvaluationType": return Optional.ofNullable(clazz.cast(evaluationTypeAsString())); case "Metrics": return Optional.ofNullable(clazz.cast(metrics())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((WindowSummary) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

      * The timestamp that defines the start of the window. *

      * * @param testWindowStart * The timestamp that defines the start of the window. * @return Returns a reference to this object so that method calls can be chained together. */ Builder testWindowStart(Instant testWindowStart); /** *

      * The timestamp that defines the end of the window. *

      * * @param testWindowEnd * The timestamp that defines the end of the window. * @return Returns a reference to this object so that method calls can be chained together. */ Builder testWindowEnd(Instant testWindowEnd); /** *

      * The number of data points within the window. *

      * * @param itemCount * The number of data points within the window. * @return Returns a reference to this object so that method calls can be chained together. */ Builder itemCount(Integer itemCount); /** *

      * The type of evaluation. *

      *
        *
      • *

        * SUMMARY - The average metrics across all windows. *

        *
      • *
      • *

        * COMPUTED - The metrics for the specified window. *

        *
      • *
      * * @param evaluationType * The type of evaluation.

      *
        *
      • *

        * SUMMARY - The average metrics across all windows. *

        *
      • *
      • *

        * COMPUTED - The metrics for the specified window. *

        *
      • * @see EvaluationType * @return Returns a reference to this object so that method calls can be chained together. * @see EvaluationType */ Builder evaluationType(String evaluationType); /** *

        * The type of evaluation. *

        *
          *
        • *

          * SUMMARY - The average metrics across all windows. *

          *
        • *
        • *

          * COMPUTED - The metrics for the specified window. *

          *
        • *
        * * @param evaluationType * The type of evaluation.

        *
          *
        • *

          * SUMMARY - The average metrics across all windows. *

          *
        • *
        • *

          * COMPUTED - The metrics for the specified window. *

          *
        • * @see EvaluationType * @return Returns a reference to this object so that method calls can be chained together. * @see EvaluationType */ Builder evaluationType(EvaluationType evaluationType); /** *

          * Provides metrics used to evaluate the performance of a predictor. *

          * * @param metrics * Provides metrics used to evaluate the performance of a predictor. * @return Returns a reference to this object so that method calls can be chained together. */ Builder metrics(Metrics metrics); /** *

          * Provides metrics used to evaluate the performance of a predictor. *

          * This is a convenience method that creates an instance of the {@link Metrics.Builder} avoiding the need to * create one manually via {@link Metrics#builder()}. * *

          * When the {@link Consumer} completes, {@link Metrics.Builder#build()} is called immediately and its result is * passed to {@link #metrics(Metrics)}. * * @param metrics * a consumer that will call methods on {@link Metrics.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #metrics(Metrics) */ default Builder metrics(Consumer metrics) { return metrics(Metrics.builder().applyMutation(metrics).build()); } } static final class BuilderImpl implements Builder { private Instant testWindowStart; private Instant testWindowEnd; private Integer itemCount; private String evaluationType; private Metrics metrics; private BuilderImpl() { } private BuilderImpl(WindowSummary model) { testWindowStart(model.testWindowStart); testWindowEnd(model.testWindowEnd); itemCount(model.itemCount); evaluationType(model.evaluationType); metrics(model.metrics); } public final Instant getTestWindowStart() { return testWindowStart; } public final void setTestWindowStart(Instant testWindowStart) { this.testWindowStart = testWindowStart; } @Override public final Builder testWindowStart(Instant testWindowStart) { this.testWindowStart = testWindowStart; return this; } public final Instant getTestWindowEnd() { return testWindowEnd; } public final void setTestWindowEnd(Instant testWindowEnd) { this.testWindowEnd = testWindowEnd; } @Override public final Builder testWindowEnd(Instant testWindowEnd) { this.testWindowEnd = testWindowEnd; return this; } public final Integer getItemCount() { return itemCount; } public final void setItemCount(Integer itemCount) { this.itemCount = itemCount; } @Override public final Builder itemCount(Integer itemCount) { this.itemCount = itemCount; return this; } public final String getEvaluationType() { return evaluationType; } public final void setEvaluationType(String evaluationType) { this.evaluationType = evaluationType; } @Override public final Builder evaluationType(String evaluationType) { this.evaluationType = evaluationType; return this; } @Override public final Builder evaluationType(EvaluationType evaluationType) { this.evaluationType(evaluationType == null ? null : evaluationType.toString()); return this; } public final Metrics.Builder getMetrics() { return metrics != null ? metrics.toBuilder() : null; } public final void setMetrics(Metrics.BuilderImpl metrics) { this.metrics = metrics != null ? metrics.build() : null; } @Override public final Builder metrics(Metrics metrics) { this.metrics = metrics; return this; } @Override public WindowSummary build() { return new WindowSummary(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy