Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
software.amazon.awssdk.services.sagemakergeospatial.model.ItemSource Maven / Gradle / Ivy
Go to download
The AWS Java SDK for Sage Maker Geospatial module holds the client classes that are used for
communicating with Sage Maker Geospatial.
/*
* 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.sagemakergeospatial.model;
import java.io.Serializable;
import java.time.Instant;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
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.core.traits.MapTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructMap;
import software.amazon.awssdk.core.util.SdkAutoConstructMap;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* The structure representing the items in the response for SearchRasterDataCollection.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class ItemSource implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField> ASSETS_FIELD = SdkField
.> builder(MarshallingType.MAP)
.memberName("Assets")
.getter(getter(ItemSource::assets))
.setter(setter(Builder::assets))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Assets").build(),
MapTrait.builder()
.keyLocationName("key")
.valueLocationName("value")
.valueFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(AssetValue::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("value").build()).build()).build()).build();
private static final SdkField DATE_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("DateTime").getter(getter(ItemSource::dateTime)).setter(setter(Builder::dateTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DateTime").build()).build();
private static final SdkField GEOMETRY_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("Geometry").getter(getter(ItemSource::geometry)).setter(setter(Builder::geometry))
.constructor(Geometry::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Geometry").build()).build();
private static final SdkField ID_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Id")
.getter(getter(ItemSource::id)).setter(setter(Builder::id))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Id").build()).build();
private static final SdkField PROPERTIES_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("Properties").getter(getter(ItemSource::properties)).setter(setter(Builder::properties))
.constructor(Properties::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Properties").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ASSETS_FIELD, DATE_TIME_FIELD,
GEOMETRY_FIELD, ID_FIELD, PROPERTIES_FIELD));
private static final Map> SDK_NAME_TO_FIELD = memberNameToFieldInitializer();
private static final long serialVersionUID = 1L;
private final Map assets;
private final Instant dateTime;
private final Geometry geometry;
private final String id;
private final Properties properties;
private ItemSource(BuilderImpl builder) {
this.assets = builder.assets;
this.dateTime = builder.dateTime;
this.geometry = builder.geometry;
this.id = builder.id;
this.properties = builder.properties;
}
/**
* For responses, this returns true if the service returned a value for the Assets property. This DOES NOT check
* that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property). This is
* useful because the SDK will never return a null collection or map, but you may need to differentiate between the
* service returning nothing (or null) and the service returning an empty collection or map. For requests, this
* returns true if a value for the property was specified in the request builder, and false if a value was not
* specified.
*/
public final boolean hasAssets() {
return assets != null && !(assets instanceof SdkAutoConstructMap);
}
/**
*
* This is a dictionary of Asset Objects data associated with the Item that can be downloaded or streamed, each with
* a unique key.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* This method will never return null. If you would like to know whether the service returned this field (so that
* you can differentiate between null and empty), you can use the {@link #hasAssets} method.
*
*
* @return This is a dictionary of Asset Objects data associated with the Item that can be downloaded or streamed,
* each with a unique key.
*/
public final Map assets() {
return assets;
}
/**
*
* The searchable date and time of the item, in UTC.
*
*
* @return The searchable date and time of the item, in UTC.
*/
public final Instant dateTime() {
return dateTime;
}
/**
*
* The item Geometry in GeoJson format.
*
*
* @return The item Geometry in GeoJson format.
*/
public final Geometry geometry() {
return geometry;
}
/**
*
* A unique Id for the source item.
*
*
* @return A unique Id for the source item.
*/
public final String id() {
return id;
}
/**
*
* This field contains additional properties of the item.
*
*
* @return This field contains additional properties of the item.
*/
public final Properties properties() {
return properties;
}
@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(hasAssets() ? assets() : null);
hashCode = 31 * hashCode + Objects.hashCode(dateTime());
hashCode = 31 * hashCode + Objects.hashCode(geometry());
hashCode = 31 * hashCode + Objects.hashCode(id());
hashCode = 31 * hashCode + Objects.hashCode(properties());
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 ItemSource)) {
return false;
}
ItemSource other = (ItemSource) obj;
return hasAssets() == other.hasAssets() && Objects.equals(assets(), other.assets())
&& Objects.equals(dateTime(), other.dateTime()) && Objects.equals(geometry(), other.geometry())
&& Objects.equals(id(), other.id()) && Objects.equals(properties(), other.properties());
}
/**
* 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("ItemSource").add("Assets", hasAssets() ? assets() : null).add("DateTime", dateTime())
.add("Geometry", geometry()).add("Id", id()).add("Properties", properties()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Assets":
return Optional.ofNullable(clazz.cast(assets()));
case "DateTime":
return Optional.ofNullable(clazz.cast(dateTime()));
case "Geometry":
return Optional.ofNullable(clazz.cast(geometry()));
case "Id":
return Optional.ofNullable(clazz.cast(id()));
case "Properties":
return Optional.ofNullable(clazz.cast(properties()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
@Override
public final Map> sdkFieldNameToField() {
return SDK_NAME_TO_FIELD;
}
private static Map> memberNameToFieldInitializer() {
Map> map = new HashMap<>();
map.put("Assets", ASSETS_FIELD);
map.put("DateTime", DATE_TIME_FIELD);
map.put("Geometry", GEOMETRY_FIELD);
map.put("Id", ID_FIELD);
map.put("Properties", PROPERTIES_FIELD);
return Collections.unmodifiableMap(map);
}
private static Function getter(Function g) {
return obj -> g.apply((ItemSource) obj);
}
private static BiConsumer setter(BiConsumer s) {
return (obj, val) -> s.accept((Builder) obj, val);
}
public interface Builder extends SdkPojo, CopyableBuilder {
/**
*
* This is a dictionary of Asset Objects data associated with the Item that can be downloaded or streamed, each
* with a unique key.
*
*
* @param assets
* This is a dictionary of Asset Objects data associated with the Item that can be downloaded or
* streamed, each with a unique key.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder assets(Map assets);
/**
*
* The searchable date and time of the item, in UTC.
*
*
* @param dateTime
* The searchable date and time of the item, in UTC.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder dateTime(Instant dateTime);
/**
*
* The item Geometry in GeoJson format.
*
*
* @param geometry
* The item Geometry in GeoJson format.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder geometry(Geometry geometry);
/**
*
* The item Geometry in GeoJson format.
*
* This is a convenience method that creates an instance of the {@link Geometry.Builder} avoiding the need to
* create one manually via {@link Geometry#builder()}.
*
*
* When the {@link Consumer} completes, {@link Geometry.Builder#build()} is called immediately and its result is
* passed to {@link #geometry(Geometry)}.
*
* @param geometry
* a consumer that will call methods on {@link Geometry.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #geometry(Geometry)
*/
default Builder geometry(Consumer geometry) {
return geometry(Geometry.builder().applyMutation(geometry).build());
}
/**
*
* A unique Id for the source item.
*
*
* @param id
* A unique Id for the source item.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder id(String id);
/**
*
* This field contains additional properties of the item.
*
*
* @param properties
* This field contains additional properties of the item.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder properties(Properties properties);
/**
*
* This field contains additional properties of the item.
*
* This is a convenience method that creates an instance of the {@link Properties.Builder} avoiding the need to
* create one manually via {@link Properties#builder()}.
*
*
* When the {@link Consumer} completes, {@link Properties.Builder#build()} is called immediately and its result
* is passed to {@link #properties(Properties)}.
*
* @param properties
* a consumer that will call methods on {@link Properties.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #properties(Properties)
*/
default Builder properties(Consumer properties) {
return properties(Properties.builder().applyMutation(properties).build());
}
}
static final class BuilderImpl implements Builder {
private Map assets = DefaultSdkAutoConstructMap.getInstance();
private Instant dateTime;
private Geometry geometry;
private String id;
private Properties properties;
private BuilderImpl() {
}
private BuilderImpl(ItemSource model) {
assets(model.assets);
dateTime(model.dateTime);
geometry(model.geometry);
id(model.id);
properties(model.properties);
}
public final Map getAssets() {
Map result = AssetsMapCopier.copyToBuilder(this.assets);
if (result instanceof SdkAutoConstructMap) {
return null;
}
return result;
}
public final void setAssets(Map assets) {
this.assets = AssetsMapCopier.copyFromBuilder(assets);
}
@Override
public final Builder assets(Map assets) {
this.assets = AssetsMapCopier.copy(assets);
return this;
}
public final Instant getDateTime() {
return dateTime;
}
public final void setDateTime(Instant dateTime) {
this.dateTime = dateTime;
}
@Override
public final Builder dateTime(Instant dateTime) {
this.dateTime = dateTime;
return this;
}
public final Geometry.Builder getGeometry() {
return geometry != null ? geometry.toBuilder() : null;
}
public final void setGeometry(Geometry.BuilderImpl geometry) {
this.geometry = geometry != null ? geometry.build() : null;
}
@Override
public final Builder geometry(Geometry geometry) {
this.geometry = geometry;
return this;
}
public final String getId() {
return id;
}
public final void setId(String id) {
this.id = id;
}
@Override
public final Builder id(String id) {
this.id = id;
return this;
}
public final Properties.Builder getProperties() {
return properties != null ? properties.toBuilder() : null;
}
public final void setProperties(Properties.BuilderImpl properties) {
this.properties = properties != null ? properties.build() : null;
}
@Override
public final Builder properties(Properties properties) {
this.properties = properties;
return this;
}
@Override
public ItemSource build() {
return new ItemSource(this);
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
@Override
public Map> sdkFieldNameToField() {
return SDK_NAME_TO_FIELD;
}
}
}