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

software.amazon.awssdk.services.location.model.ListGeofenceResponseEntry Maven / Gradle / Ivy

/*
 * 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.location.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.traits.TimestampFormatTrait;
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;

/**
 * 

* Contains a list of geofences stored in a given geofence collection. *

* *

* The returned geometry will always match the geometry format used when the geofence was created. *

*
*/ @Generated("software.amazon.awssdk:codegen") public final class ListGeofenceResponseEntry implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField GEOFENCE_ID_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("GeofenceId").getter(getter(ListGeofenceResponseEntry::geofenceId)).setter(setter(Builder::geofenceId)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("GeofenceId").build()).build(); private static final SdkField GEOMETRY_FIELD = SdkField . builder(MarshallingType.SDK_POJO).memberName("Geometry") .getter(getter(ListGeofenceResponseEntry::geometry)).setter(setter(Builder::geometry)) .constructor(GeofenceGeometry::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Geometry").build()).build(); private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Status") .getter(getter(ListGeofenceResponseEntry::status)).setter(setter(Builder::status)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Status").build()).build(); private static final SdkField CREATE_TIME_FIELD = SdkField . builder(MarshallingType.INSTANT) .memberName("CreateTime") .getter(getter(ListGeofenceResponseEntry::createTime)) .setter(setter(Builder::createTime)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreateTime").build(), TimestampFormatTrait.create(TimestampFormatTrait.Format.ISO_8601)).build(); private static final SdkField UPDATE_TIME_FIELD = SdkField . builder(MarshallingType.INSTANT) .memberName("UpdateTime") .getter(getter(ListGeofenceResponseEntry::updateTime)) .setter(setter(Builder::updateTime)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("UpdateTime").build(), TimestampFormatTrait.create(TimestampFormatTrait.Format.ISO_8601)).build(); private static final SdkField> GEOFENCE_PROPERTIES_FIELD = SdkField .> builder(MarshallingType.MAP) .memberName("GeofenceProperties") .getter(getter(ListGeofenceResponseEntry::geofenceProperties)) .setter(setter(Builder::geofenceProperties)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("GeofenceProperties").build(), MapTrait.builder() .keyLocationName("key") .valueLocationName("value") .valueFieldInfo( SdkField. builder(MarshallingType.STRING) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("value").build()).build()).build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(GEOFENCE_ID_FIELD, GEOMETRY_FIELD, STATUS_FIELD, CREATE_TIME_FIELD, UPDATE_TIME_FIELD, GEOFENCE_PROPERTIES_FIELD)); private static final Map> SDK_NAME_TO_FIELD = memberNameToFieldInitializer(); private static final long serialVersionUID = 1L; private final String geofenceId; private final GeofenceGeometry geometry; private final String status; private final Instant createTime; private final Instant updateTime; private final Map geofenceProperties; private ListGeofenceResponseEntry(BuilderImpl builder) { this.geofenceId = builder.geofenceId; this.geometry = builder.geometry; this.status = builder.status; this.createTime = builder.createTime; this.updateTime = builder.updateTime; this.geofenceProperties = builder.geofenceProperties; } /** *

* The geofence identifier. *

* * @return The geofence identifier. */ public final String geofenceId() { return geofenceId; } /** *

* Contains the geofence geometry details describing a polygon or a circle. *

* * @return Contains the geofence geometry details describing a polygon or a circle. */ public final GeofenceGeometry geometry() { return geometry; } /** *

* Identifies the state of the geofence. A geofence will hold one of the following states: *

*
    *
  • *

    * ACTIVE — The geofence has been indexed by the system. *

    *
  • *
  • *

    * PENDING — The geofence is being processed by the system. *

    *
  • *
  • *

    * FAILED — The geofence failed to be indexed by the system. *

    *
  • *
  • *

    * DELETED — The geofence has been deleted from the system index. *

    *
  • *
  • *

    * DELETING — The geofence is being deleted from the system index. *

    *
  • *
* * @return Identifies the state of the geofence. A geofence will hold one of the following states:

*
    *
  • *

    * ACTIVE — The geofence has been indexed by the system. *

    *
  • *
  • *

    * PENDING — The geofence is being processed by the system. *

    *
  • *
  • *

    * FAILED — The geofence failed to be indexed by the system. *

    *
  • *
  • *

    * DELETED — The geofence has been deleted from the system index. *

    *
  • *
  • *

    * DELETING — The geofence is being deleted from the system index. *

    *
  • */ public final String status() { return status; } /** *

    * The timestamp for when the geofence was stored in a geofence collection in ISO 8601 format: * YYYY-MM-DDThh:mm:ss.sssZ *

    * * @return The timestamp for when the geofence was stored in a geofence collection in ISO 8601 format: * YYYY-MM-DDThh:mm:ss.sssZ */ public final Instant createTime() { return createTime; } /** *

    * The timestamp for when the geofence was last updated in ISO 8601 format: * YYYY-MM-DDThh:mm:ss.sssZ *

    * * @return The timestamp for when the geofence was last updated in ISO 8601 format: * YYYY-MM-DDThh:mm:ss.sssZ */ public final Instant updateTime() { return updateTime; } /** * For responses, this returns true if the service returned a value for the GeofenceProperties 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 hasGeofenceProperties() { return geofenceProperties != null && !(geofenceProperties instanceof SdkAutoConstructMap); } /** *

    * User defined properties of the geofence. A property is a key-value pair stored with the geofence and added to any * geofence event triggered with that geofence. *

    *

    * Format: "key" : "value" *

    *

    * 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 #hasGeofenceProperties} method. *

    * * @return User defined properties of the geofence. A property is a key-value pair stored with the geofence and * added to any geofence event triggered with that geofence.

    *

    * Format: "key" : "value" */ public final Map geofenceProperties() { return geofenceProperties; } @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(geofenceId()); hashCode = 31 * hashCode + Objects.hashCode(geometry()); hashCode = 31 * hashCode + Objects.hashCode(status()); hashCode = 31 * hashCode + Objects.hashCode(createTime()); hashCode = 31 * hashCode + Objects.hashCode(updateTime()); hashCode = 31 * hashCode + Objects.hashCode(hasGeofenceProperties() ? geofenceProperties() : null); 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 ListGeofenceResponseEntry)) { return false; } ListGeofenceResponseEntry other = (ListGeofenceResponseEntry) obj; return Objects.equals(geofenceId(), other.geofenceId()) && Objects.equals(geometry(), other.geometry()) && Objects.equals(status(), other.status()) && Objects.equals(createTime(), other.createTime()) && Objects.equals(updateTime(), other.updateTime()) && hasGeofenceProperties() == other.hasGeofenceProperties() && Objects.equals(geofenceProperties(), other.geofenceProperties()); } /** * 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("ListGeofenceResponseEntry").add("GeofenceId", geofenceId()).add("Geometry", geometry()) .add("Status", status()).add("CreateTime", createTime()).add("UpdateTime", updateTime()) .add("GeofenceProperties", geofenceProperties() == null ? null : "*** Sensitive Data Redacted ***").build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "GeofenceId": return Optional.ofNullable(clazz.cast(geofenceId())); case "Geometry": return Optional.ofNullable(clazz.cast(geometry())); case "Status": return Optional.ofNullable(clazz.cast(status())); case "CreateTime": return Optional.ofNullable(clazz.cast(createTime())); case "UpdateTime": return Optional.ofNullable(clazz.cast(updateTime())); case "GeofenceProperties": return Optional.ofNullable(clazz.cast(geofenceProperties())); 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("GeofenceId", GEOFENCE_ID_FIELD); map.put("Geometry", GEOMETRY_FIELD); map.put("Status", STATUS_FIELD); map.put("CreateTime", CREATE_TIME_FIELD); map.put("UpdateTime", UPDATE_TIME_FIELD); map.put("GeofenceProperties", GEOFENCE_PROPERTIES_FIELD); return Collections.unmodifiableMap(map); } private static Function getter(Function g) { return obj -> g.apply((ListGeofenceResponseEntry) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

    * The geofence identifier. *

    * * @param geofenceId * The geofence identifier. * @return Returns a reference to this object so that method calls can be chained together. */ Builder geofenceId(String geofenceId); /** *

    * Contains the geofence geometry details describing a polygon or a circle. *

    * * @param geometry * Contains the geofence geometry details describing a polygon or a circle. * @return Returns a reference to this object so that method calls can be chained together. */ Builder geometry(GeofenceGeometry geometry); /** *

    * Contains the geofence geometry details describing a polygon or a circle. *

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

    * When the {@link Consumer} completes, {@link GeofenceGeometry.Builder#build()} is called immediately and its * result is passed to {@link #geometry(GeofenceGeometry)}. * * @param geometry * a consumer that will call methods on {@link GeofenceGeometry.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #geometry(GeofenceGeometry) */ default Builder geometry(Consumer geometry) { return geometry(GeofenceGeometry.builder().applyMutation(geometry).build()); } /** *

    * Identifies the state of the geofence. A geofence will hold one of the following states: *

    *
      *
    • *

      * ACTIVE — The geofence has been indexed by the system. *

      *
    • *
    • *

      * PENDING — The geofence is being processed by the system. *

      *
    • *
    • *

      * FAILED — The geofence failed to be indexed by the system. *

      *
    • *
    • *

      * DELETED — The geofence has been deleted from the system index. *

      *
    • *
    • *

      * DELETING — The geofence is being deleted from the system index. *

      *
    • *
    * * @param status * Identifies the state of the geofence. A geofence will hold one of the following states:

    *
      *
    • *

      * ACTIVE — The geofence has been indexed by the system. *

      *
    • *
    • *

      * PENDING — The geofence is being processed by the system. *

      *
    • *
    • *

      * FAILED — The geofence failed to be indexed by the system. *

      *
    • *
    • *

      * DELETED — The geofence has been deleted from the system index. *

      *
    • *
    • *

      * DELETING — The geofence is being deleted from the system index. *

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

      * The timestamp for when the geofence was stored in a geofence collection in ISO 8601 format: * YYYY-MM-DDThh:mm:ss.sssZ *

      * * @param createTime * The timestamp for when the geofence was stored in a geofence collection in ISO 8601 format: * YYYY-MM-DDThh:mm:ss.sssZ * @return Returns a reference to this object so that method calls can be chained together. */ Builder createTime(Instant createTime); /** *

      * The timestamp for when the geofence was last updated in ISO 8601 format: * YYYY-MM-DDThh:mm:ss.sssZ *

      * * @param updateTime * The timestamp for when the geofence was last updated in ISO 8601 format: * YYYY-MM-DDThh:mm:ss.sssZ * @return Returns a reference to this object so that method calls can be chained together. */ Builder updateTime(Instant updateTime); /** *

      * User defined properties of the geofence. A property is a key-value pair stored with the geofence and added to * any geofence event triggered with that geofence. *

      *

      * Format: "key" : "value" *

      * * @param geofenceProperties * User defined properties of the geofence. A property is a key-value pair stored with the geofence and * added to any geofence event triggered with that geofence.

      *

      * Format: "key" : "value" * @return Returns a reference to this object so that method calls can be chained together. */ Builder geofenceProperties(Map geofenceProperties); } static final class BuilderImpl implements Builder { private String geofenceId; private GeofenceGeometry geometry; private String status; private Instant createTime; private Instant updateTime; private Map geofenceProperties = DefaultSdkAutoConstructMap.getInstance(); private BuilderImpl() { } private BuilderImpl(ListGeofenceResponseEntry model) { geofenceId(model.geofenceId); geometry(model.geometry); status(model.status); createTime(model.createTime); updateTime(model.updateTime); geofenceProperties(model.geofenceProperties); } public final String getGeofenceId() { return geofenceId; } public final void setGeofenceId(String geofenceId) { this.geofenceId = geofenceId; } @Override public final Builder geofenceId(String geofenceId) { this.geofenceId = geofenceId; return this; } public final GeofenceGeometry.Builder getGeometry() { return geometry != null ? geometry.toBuilder() : null; } public final void setGeometry(GeofenceGeometry.BuilderImpl geometry) { this.geometry = geometry != null ? geometry.build() : null; } @Override public final Builder geometry(GeofenceGeometry geometry) { this.geometry = geometry; return this; } public final String getStatus() { return status; } public final void setStatus(String status) { this.status = status; } @Override public final Builder status(String status) { this.status = status; return this; } public final Instant getCreateTime() { return createTime; } public final void setCreateTime(Instant createTime) { this.createTime = createTime; } @Override public final Builder createTime(Instant createTime) { this.createTime = createTime; return this; } public final Instant getUpdateTime() { return updateTime; } public final void setUpdateTime(Instant updateTime) { this.updateTime = updateTime; } @Override public final Builder updateTime(Instant updateTime) { this.updateTime = updateTime; return this; } public final Map getGeofenceProperties() { if (geofenceProperties instanceof SdkAutoConstructMap) { return null; } return geofenceProperties; } public final void setGeofenceProperties(Map geofenceProperties) { this.geofenceProperties = PropertyMapCopier.copy(geofenceProperties); } @Override public final Builder geofenceProperties(Map geofenceProperties) { this.geofenceProperties = PropertyMapCopier.copy(geofenceProperties); return this; } @Override public ListGeofenceResponseEntry build() { return new ListGeofenceResponseEntry(this); } @Override public List> sdkFields() { return SDK_FIELDS; } @Override public Map> sdkFieldNameToField() { return SDK_NAME_TO_FIELD; } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy