/* * Copyright 2018-2023 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 com.amazonaws.services.pinpoint.model; import java.io.Serializable; import javax.annotation.Generated; import com.amazonaws.protocol.StructuredPojo; import com.amazonaws.protocol.ProtocolMarshaller; /** *

* Specifies the dimension settings for a segment. *

* * @see AWS API * Documentation */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class SegmentDimensions implements Serializable, Cloneable, StructuredPojo { /** *

* One or more custom attributes to use as criteria for the segment. *

*/ private java.util.Map attributes; /** *

* The behavior-based criteria, such as how recently users have used your app, for the segment. *

*/ private SegmentBehaviors behavior; /** *

* The demographic-based criteria, such as device platform, for the segment. *

*/ private SegmentDemographics demographic; /** *

* The location-based criteria, such as region or GPS coordinates, for the segment. *

*/ private SegmentLocation location; /** *

* One or more custom metrics to use as criteria for the segment. *

*/ private java.util.Map metrics; /** *

* One or more custom user attributes to use as criteria for the segment. *

*/ private java.util.Map userAttributes; /** *

* One or more custom attributes to use as criteria for the segment. *

* * @return One or more custom attributes to use as criteria for the segment. */ public java.util.Map getAttributes() { return attributes; } /** *

* One or more custom attributes to use as criteria for the segment. *

* * @param attributes * One or more custom attributes to use as criteria for the segment. */ public void setAttributes(java.util.Map attributes) { this.attributes = attributes; } /** *

* One or more custom attributes to use as criteria for the segment. *

* * @param attributes * One or more custom attributes to use as criteria for the segment. * @return Returns a reference to this object so that method calls can be chained together. */ public SegmentDimensions withAttributes(java.util.Map attributes) { setAttributes(attributes); return this; } /** * Add a single Attributes entry * * @see SegmentDimensions#withAttributes * @returns a reference to this object so that method calls can be chained together. */ public SegmentDimensions addAttributesEntry(String key, AttributeDimension value) { if (null == this.attributes) { this.attributes = new java.util.HashMap(); } if (this.attributes.containsKey(key)) throw new IllegalArgumentException("Duplicated keys (" + key.toString() + ") are provided."); this.attributes.put(key, value); return this; } /** * Removes all the entries added into Attributes. * * @return Returns a reference to this object so that method calls can be chained together. */ public SegmentDimensions clearAttributesEntries() { this.attributes = null; return this; } /** *

* The behavior-based criteria, such as how recently users have used your app, for the segment. *

* * @param behavior * The behavior-based criteria, such as how recently users have used your app, for the segment. */ public void setBehavior(SegmentBehaviors behavior) { this.behavior = behavior; } /** *

* The behavior-based criteria, such as how recently users have used your app, for the segment. *

* * @return The behavior-based criteria, such as how recently users have used your app, for the segment. */ public SegmentBehaviors getBehavior() { return this.behavior; } /** *

* The behavior-based criteria, such as how recently users have used your app, for the segment. *

* * @param behavior * The behavior-based criteria, such as how recently users have used your app, for the segment. * @return Returns a reference to this object so that method calls can be chained together. */ public SegmentDimensions withBehavior(SegmentBehaviors behavior) { setBehavior(behavior); return this; } /** *

* The demographic-based criteria, such as device platform, for the segment. *

* * @param demographic * The demographic-based criteria, such as device platform, for the segment. */ public void setDemographic(SegmentDemographics demographic) { this.demographic = demographic; } /** *

* The demographic-based criteria, such as device platform, for the segment. *

* * @return The demographic-based criteria, such as device platform, for the segment. */ public SegmentDemographics getDemographic() { return this.demographic; } /** *

* The demographic-based criteria, such as device platform, for the segment. *

* * @param demographic * The demographic-based criteria, such as device platform, for the segment. * @return Returns a reference to this object so that method calls can be chained together. */ public SegmentDimensions withDemographic(SegmentDemographics demographic) { setDemographic(demographic); return this; } /** *

* The location-based criteria, such as region or GPS coordinates, for the segment. *

* * @param location * The location-based criteria, such as region or GPS coordinates, for the segment. */ public void setLocation(SegmentLocation location) { this.location = location; } /** *

* The location-based criteria, such as region or GPS coordinates, for the segment. *

* * @return The location-based criteria, such as region or GPS coordinates, for the segment. */ public SegmentLocation getLocation() { return this.location; } /** *

* The location-based criteria, such as region or GPS coordinates, for the segment. *

* * @param location * The location-based criteria, such as region or GPS coordinates, for the segment. * @return Returns a reference to this object so that method calls can be chained together. */ public SegmentDimensions withLocation(SegmentLocation location) { setLocation(location); return this; } /** *

* One or more custom metrics to use as criteria for the segment. *

* * @return One or more custom metrics to use as criteria for the segment. */ public java.util.Map getMetrics() { return metrics; } /** *

* One or more custom metrics to use as criteria for the segment. *

* * @param metrics * One or more custom metrics to use as criteria for the segment. */ public void setMetrics(java.util.Map metrics) { this.metrics = metrics; } /** *

* One or more custom metrics to use as criteria for the segment. *

* * @param metrics * One or more custom metrics to use as criteria for the segment. * @return Returns a reference to this object so that method calls can be chained together. */ public SegmentDimensions withMetrics(java.util.Map metrics) { setMetrics(metrics); return this; } /** * Add a single Metrics entry * * @see SegmentDimensions#withMetrics * @returns a reference to this object so that method calls can be chained together. */ public SegmentDimensions addMetricsEntry(String key, MetricDimension value) { if (null == this.metrics) { this.metrics = new java.util.HashMap(); } if (this.metrics.containsKey(key)) throw new IllegalArgumentException("Duplicated keys (" + key.toString() + ") are provided."); this.metrics.put(key, value); return this; } /** * Removes all the entries added into Metrics. * * @return Returns a reference to this object so that method calls can be chained together. */ public SegmentDimensions clearMetricsEntries() { this.metrics = null; return this; } /** *

* One or more custom user attributes to use as criteria for the segment. *

* * @return One or more custom user attributes to use as criteria for the segment. */ public java.util.Map getUserAttributes() { return userAttributes; } /** *

* One or more custom user attributes to use as criteria for the segment. *

* * @param userAttributes * One or more custom user attributes to use as criteria for the segment. */ public void setUserAttributes(java.util.Map userAttributes) { this.userAttributes = userAttributes; } /** *

* One or more custom user attributes to use as criteria for the segment. *

* * @param userAttributes * One or more custom user attributes to use as criteria for the segment. * @return Returns a reference to this object so that method calls can be chained together. */ public SegmentDimensions withUserAttributes(java.util.Map userAttributes) { setUserAttributes(userAttributes); return this; } /** * Add a single UserAttributes entry * * @see SegmentDimensions#withUserAttributes * @returns a reference to this object so that method calls can be chained together. */ public SegmentDimensions addUserAttributesEntry(String key, AttributeDimension value) { if (null == this.userAttributes) { this.userAttributes = new java.util.HashMap(); } if (this.userAttributes.containsKey(key)) throw new IllegalArgumentException("Duplicated keys (" + key.toString() + ") are provided."); this.userAttributes.put(key, value); return this; } /** * Removes all the entries added into UserAttributes. * * @return Returns a reference to this object so that method calls can be chained together. */ public SegmentDimensions clearUserAttributesEntries() { this.userAttributes = null; return this; } /** * 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. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getAttributes() != null) sb.append("Attributes: ").append(getAttributes()).append(","); if (getBehavior() != null) sb.append("Behavior: ").append(getBehavior()).append(","); if (getDemographic() != null) sb.append("Demographic: ").append(getDemographic()).append(","); if (getLocation() != null) sb.append("Location: ").append(getLocation()).append(","); if (getMetrics() != null) sb.append("Metrics: ").append(getMetrics()).append(","); if (getUserAttributes() != null) sb.append("UserAttributes: ").append(getUserAttributes()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof SegmentDimensions == false) return false; SegmentDimensions other = (SegmentDimensions) obj; if (other.getAttributes() == null ^ this.getAttributes() == null) return false; if (other.getAttributes() != null && other.getAttributes().equals(this.getAttributes()) == false) return false; if (other.getBehavior() == null ^ this.getBehavior() == null) return false; if (other.getBehavior() != null && other.getBehavior().equals(this.getBehavior()) == false) return false; if (other.getDemographic() == null ^ this.getDemographic() == null) return false; if (other.getDemographic() != null && other.getDemographic().equals(this.getDemographic()) == false) return false; if (other.getLocation() == null ^ this.getLocation() == null) return false; if (other.getLocation() != null && other.getLocation().equals(this.getLocation()) == false) return false; if (other.getMetrics() == null ^ this.getMetrics() == null) return false; if (other.getMetrics() != null && other.getMetrics().equals(this.getMetrics()) == false) return false; if (other.getUserAttributes() == null ^ this.getUserAttributes() == null) return false; if (other.getUserAttributes() != null && other.getUserAttributes().equals(this.getUserAttributes()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getAttributes() == null) ? 0 : getAttributes().hashCode()); hashCode = prime * hashCode + ((getBehavior() == null) ? 0 : getBehavior().hashCode()); hashCode = prime * hashCode + ((getDemographic() == null) ? 0 : getDemographic().hashCode()); hashCode = prime * hashCode + ((getLocation() == null) ? 0 : getLocation().hashCode()); hashCode = prime * hashCode + ((getMetrics() == null) ? 0 : getMetrics().hashCode()); hashCode = prime * hashCode + ((getUserAttributes() == null) ? 0 : getUserAttributes().hashCode()); return hashCode; } @Override public SegmentDimensions clone() { try { return (SegmentDimensions) super.clone(); } catch (CloneNotSupportedException e) { throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e); } } @com.amazonaws.annotation.SdkInternalApi @Override public void marshall(ProtocolMarshaller protocolMarshaller) { com.amazonaws.services.pinpoint.model.transform.SegmentDimensionsMarshaller.getInstance().marshall(this, protocolMarshaller); } }