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

software.amazon.awssdk.services.forecast.model.TimeAlignmentBoundary 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.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;

/**
 * 

* The time boundary Forecast uses to align and aggregate your data to match your forecast frequency. Provide the unit * of time and the time boundary as a key value pair. If you don't provide a time boundary, Forecast uses a set of Default Time * Boundaries. *

*

* For more information about aggregation, see Data Aggregation for Different Forecast * Frequencies. For more information setting a custom time boundary, see Specifying a * Time Boundary. *

*/ @Generated("software.amazon.awssdk:codegen") public final class TimeAlignmentBoundary implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField MONTH_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Month") .getter(getter(TimeAlignmentBoundary::monthAsString)).setter(setter(Builder::month)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Month").build()).build(); private static final SdkField DAY_OF_MONTH_FIELD = SdkField. builder(MarshallingType.INTEGER) .memberName("DayOfMonth").getter(getter(TimeAlignmentBoundary::dayOfMonth)).setter(setter(Builder::dayOfMonth)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DayOfMonth").build()).build(); private static final SdkField DAY_OF_WEEK_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("DayOfWeek").getter(getter(TimeAlignmentBoundary::dayOfWeekAsString)).setter(setter(Builder::dayOfWeek)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DayOfWeek").build()).build(); private static final SdkField HOUR_FIELD = SdkField. builder(MarshallingType.INTEGER).memberName("Hour") .getter(getter(TimeAlignmentBoundary::hour)).setter(setter(Builder::hour)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Hour").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(MONTH_FIELD, DAY_OF_MONTH_FIELD, DAY_OF_WEEK_FIELD, HOUR_FIELD)); private static final long serialVersionUID = 1L; private final String month; private final Integer dayOfMonth; private final String dayOfWeek; private final Integer hour; private TimeAlignmentBoundary(BuilderImpl builder) { this.month = builder.month; this.dayOfMonth = builder.dayOfMonth; this.dayOfWeek = builder.dayOfWeek; this.hour = builder.hour; } /** *

* The month to use for time alignment during aggregation. The month must be in uppercase. *

*

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

* * @return The month to use for time alignment during aggregation. The month must be in uppercase. * @see Month */ public final Month month() { return Month.fromValue(month); } /** *

* The month to use for time alignment during aggregation. The month must be in uppercase. *

*

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

* * @return The month to use for time alignment during aggregation. The month must be in uppercase. * @see Month */ public final String monthAsString() { return month; } /** *

* The day of the month to use for time alignment during aggregation. *

* * @return The day of the month to use for time alignment during aggregation. */ public final Integer dayOfMonth() { return dayOfMonth; } /** *

* The day of week to use for time alignment during aggregation. The day must be in uppercase. *

*

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

* * @return The day of week to use for time alignment during aggregation. The day must be in uppercase. * @see DayOfWeek */ public final DayOfWeek dayOfWeek() { return DayOfWeek.fromValue(dayOfWeek); } /** *

* The day of week to use for time alignment during aggregation. The day must be in uppercase. *

*

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

* * @return The day of week to use for time alignment during aggregation. The day must be in uppercase. * @see DayOfWeek */ public final String dayOfWeekAsString() { return dayOfWeek; } /** *

* The hour of day to use for time alignment during aggregation. *

* * @return The hour of day to use for time alignment during aggregation. */ public final Integer hour() { return hour; } @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(monthAsString()); hashCode = 31 * hashCode + Objects.hashCode(dayOfMonth()); hashCode = 31 * hashCode + Objects.hashCode(dayOfWeekAsString()); hashCode = 31 * hashCode + Objects.hashCode(hour()); 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 TimeAlignmentBoundary)) { return false; } TimeAlignmentBoundary other = (TimeAlignmentBoundary) obj; return Objects.equals(monthAsString(), other.monthAsString()) && Objects.equals(dayOfMonth(), other.dayOfMonth()) && Objects.equals(dayOfWeekAsString(), other.dayOfWeekAsString()) && Objects.equals(hour(), other.hour()); } /** * 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("TimeAlignmentBoundary").add("Month", monthAsString()).add("DayOfMonth", dayOfMonth()) .add("DayOfWeek", dayOfWeekAsString()).add("Hour", hour()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "Month": return Optional.ofNullable(clazz.cast(monthAsString())); case "DayOfMonth": return Optional.ofNullable(clazz.cast(dayOfMonth())); case "DayOfWeek": return Optional.ofNullable(clazz.cast(dayOfWeekAsString())); case "Hour": return Optional.ofNullable(clazz.cast(hour())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((TimeAlignmentBoundary) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The month to use for time alignment during aggregation. The month must be in uppercase. *

* * @param month * The month to use for time alignment during aggregation. The month must be in uppercase. * @see Month * @return Returns a reference to this object so that method calls can be chained together. * @see Month */ Builder month(String month); /** *

* The month to use for time alignment during aggregation. The month must be in uppercase. *

* * @param month * The month to use for time alignment during aggregation. The month must be in uppercase. * @see Month * @return Returns a reference to this object so that method calls can be chained together. * @see Month */ Builder month(Month month); /** *

* The day of the month to use for time alignment during aggregation. *

* * @param dayOfMonth * The day of the month to use for time alignment during aggregation. * @return Returns a reference to this object so that method calls can be chained together. */ Builder dayOfMonth(Integer dayOfMonth); /** *

* The day of week to use for time alignment during aggregation. The day must be in uppercase. *

* * @param dayOfWeek * The day of week to use for time alignment during aggregation. The day must be in uppercase. * @see DayOfWeek * @return Returns a reference to this object so that method calls can be chained together. * @see DayOfWeek */ Builder dayOfWeek(String dayOfWeek); /** *

* The day of week to use for time alignment during aggregation. The day must be in uppercase. *

* * @param dayOfWeek * The day of week to use for time alignment during aggregation. The day must be in uppercase. * @see DayOfWeek * @return Returns a reference to this object so that method calls can be chained together. * @see DayOfWeek */ Builder dayOfWeek(DayOfWeek dayOfWeek); /** *

* The hour of day to use for time alignment during aggregation. *

* * @param hour * The hour of day to use for time alignment during aggregation. * @return Returns a reference to this object so that method calls can be chained together. */ Builder hour(Integer hour); } static final class BuilderImpl implements Builder { private String month; private Integer dayOfMonth; private String dayOfWeek; private Integer hour; private BuilderImpl() { } private BuilderImpl(TimeAlignmentBoundary model) { month(model.month); dayOfMonth(model.dayOfMonth); dayOfWeek(model.dayOfWeek); hour(model.hour); } public final String getMonth() { return month; } public final void setMonth(String month) { this.month = month; } @Override public final Builder month(String month) { this.month = month; return this; } @Override public final Builder month(Month month) { this.month(month == null ? null : month.toString()); return this; } public final Integer getDayOfMonth() { return dayOfMonth; } public final void setDayOfMonth(Integer dayOfMonth) { this.dayOfMonth = dayOfMonth; } @Override public final Builder dayOfMonth(Integer dayOfMonth) { this.dayOfMonth = dayOfMonth; return this; } public final String getDayOfWeek() { return dayOfWeek; } public final void setDayOfWeek(String dayOfWeek) { this.dayOfWeek = dayOfWeek; } @Override public final Builder dayOfWeek(String dayOfWeek) { this.dayOfWeek = dayOfWeek; return this; } @Override public final Builder dayOfWeek(DayOfWeek dayOfWeek) { this.dayOfWeek(dayOfWeek == null ? null : dayOfWeek.toString()); return this; } public final Integer getHour() { return hour; } public final void setHour(Integer hour) { this.hour = hour; } @Override public final Builder hour(Integer hour) { this.hour = hour; return this; } @Override public TimeAlignmentBoundary build() { return new TimeAlignmentBoundary(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy