/* * Copyright 2010-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.connect.model; import java.io.Serializable; /** *

* Contains summary information about a reference. ReferenceSummary * contains only one non null field between the URL and attachment based on the * reference type. *

*/ public class ReferenceSummary implements Serializable { /** *

* Information about the reference when the referenceType is * URL. Otherwise, null. *

*/ private UrlReference url; /** *

* Information about the reference when the referenceType is * ATTACHMENT. Otherwise, null. *

*/ private AttachmentReference attachment; /** *

* Information about a reference when the referenceType is * STRING. Otherwise, null. *

*/ private StringReference stringValue; /** *

* Information about a reference when the referenceType is * NUMBER. Otherwise, null. *

*/ private NumberReference number; /** *

* Information about a reference when the referenceType is * DATE. Otherwise, null. *

*/ private DateReference dateValue; /** *

* Information about a reference when the referenceType is * EMAIL. Otherwise, null. *

*/ private EmailReference email; /** *

* Information about the reference when the referenceType is * URL. Otherwise, null. *

* * @return

* Information about the reference when the * referenceType is URL. Otherwise, null. *

*/ public UrlReference getUrl() { return url; } /** *

* Information about the reference when the referenceType is * URL. Otherwise, null. *

* * @param url

* Information about the reference when the * referenceType is URL. Otherwise, * null. *

*/ public void setUrl(UrlReference url) { this.url = url; } /** *

* Information about the reference when the referenceType is * URL. Otherwise, null. *

*

* Returns a reference to this object so that method calls can be chained * together. * * @param url

* Information about the reference when the * referenceType is URL. Otherwise, * null. *

* @return A reference to this updated object so that method calls can be * chained together. */ public ReferenceSummary withUrl(UrlReference url) { this.url = url; return this; } /** *

* Information about the reference when the referenceType is * ATTACHMENT. Otherwise, null. *

* * @return

* Information about the reference when the * referenceType is ATTACHMENT. Otherwise, * null. *

*/ public AttachmentReference getAttachment() { return attachment; } /** *

* Information about the reference when the referenceType is * ATTACHMENT. Otherwise, null. *

* * @param attachment

* Information about the reference when the * referenceType is ATTACHMENT. * Otherwise, null. *

*/ public void setAttachment(AttachmentReference attachment) { this.attachment = attachment; } /** *

* Information about the reference when the referenceType is * ATTACHMENT. Otherwise, null. *

*

* Returns a reference to this object so that method calls can be chained * together. * * @param attachment

* Information about the reference when the * referenceType is ATTACHMENT. * Otherwise, null. *

* @return A reference to this updated object so that method calls can be * chained together. */ public ReferenceSummary withAttachment(AttachmentReference attachment) { this.attachment = attachment; return this; } /** *

* Information about a reference when the referenceType is * STRING. Otherwise, null. *

* * @return

* Information about a reference when the referenceType * is STRING. Otherwise, null. *

*/ public StringReference getString() { return stringValue; } /** *

* Information about a reference when the referenceType is * STRING. Otherwise, null. *

* * @param stringValue

* Information about a reference when the * referenceType is STRING. Otherwise, * null. *

*/ public void setString(StringReference stringValue) { this.stringValue = stringValue; } /** *

* Information about a reference when the referenceType is * STRING. Otherwise, null. *

*

* Returns a reference to this object so that method calls can be chained * together. * * @param stringValue

* Information about a reference when the * referenceType is STRING. Otherwise, * null. *

* @return A reference to this updated object so that method calls can be * chained together. */ public ReferenceSummary withString(StringReference stringValue) { this.stringValue = stringValue; return this; } /** *

* Information about a reference when the referenceType is * NUMBER. Otherwise, null. *

* * @return

* Information about a reference when the referenceType * is NUMBER. Otherwise, null. *

*/ public NumberReference getNumber() { return number; } /** *

* Information about a reference when the referenceType is * NUMBER. Otherwise, null. *

* * @param number

* Information about a reference when the * referenceType is NUMBER. Otherwise, * null. *

*/ public void setNumber(NumberReference number) { this.number = number; } /** *

* Information about a reference when the referenceType is * NUMBER. Otherwise, null. *

*

* Returns a reference to this object so that method calls can be chained * together. * * @param number

* Information about a reference when the * referenceType is NUMBER. Otherwise, * null. *

* @return A reference to this updated object so that method calls can be * chained together. */ public ReferenceSummary withNumber(NumberReference number) { this.number = number; return this; } /** *

* Information about a reference when the referenceType is * DATE. Otherwise, null. *

* * @return

* Information about a reference when the referenceType * is DATE. Otherwise, null. *

*/ public DateReference getDate() { return dateValue; } /** *

* Information about a reference when the referenceType is * DATE. Otherwise, null. *

* * @param dateValue

* Information about a reference when the * referenceType is DATE. Otherwise, * null. *

*/ public void setDate(DateReference dateValue) { this.dateValue = dateValue; } /** *

* Information about a reference when the referenceType is * DATE. Otherwise, null. *

*

* Returns a reference to this object so that method calls can be chained * together. * * @param dateValue

* Information about a reference when the * referenceType is DATE. Otherwise, * null. *

* @return A reference to this updated object so that method calls can be * chained together. */ public ReferenceSummary withDate(DateReference dateValue) { this.dateValue = dateValue; return this; } /** *

* Information about a reference when the referenceType is * EMAIL. Otherwise, null. *

* * @return

* Information about a reference when the referenceType * is EMAIL. Otherwise, null. *

*/ public EmailReference getEmail() { return email; } /** *

* Information about a reference when the referenceType is * EMAIL. Otherwise, null. *

* * @param email

* Information about a reference when the * referenceType is EMAIL. Otherwise, * null. *

*/ public void setEmail(EmailReference email) { this.email = email; } /** *

* Information about a reference when the referenceType is * EMAIL. Otherwise, null. *

*

* Returns a reference to this object so that method calls can be chained * together. * * @param email

* Information about a reference when the * referenceType is EMAIL. Otherwise, * null. *

* @return A reference to this updated object so that method calls can be * chained together. */ public ReferenceSummary withEmail(EmailReference email) { this.email = email; return this; } /** * Returns a string representation of this object; useful for testing and * debugging. * * @return A string representation of this object. * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getUrl() != null) sb.append("Url: " + getUrl() + ","); if (getAttachment() != null) sb.append("Attachment: " + getAttachment() + ","); if (getString() != null) sb.append("String: " + getString() + ","); if (getNumber() != null) sb.append("Number: " + getNumber() + ","); if (getDate() != null) sb.append("Date: " + getDate() + ","); if (getEmail() != null) sb.append("Email: " + getEmail()); sb.append("}"); return sb.toString(); } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getUrl() == null) ? 0 : getUrl().hashCode()); hashCode = prime * hashCode + ((getAttachment() == null) ? 0 : getAttachment().hashCode()); hashCode = prime * hashCode + ((getString() == null) ? 0 : getString().hashCode()); hashCode = prime * hashCode + ((getNumber() == null) ? 0 : getNumber().hashCode()); hashCode = prime * hashCode + ((getDate() == null) ? 0 : getDate().hashCode()); hashCode = prime * hashCode + ((getEmail() == null) ? 0 : getEmail().hashCode()); return hashCode; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof ReferenceSummary == false) return false; ReferenceSummary other = (ReferenceSummary) obj; if (other.getUrl() == null ^ this.getUrl() == null) return false; if (other.getUrl() != null && other.getUrl().equals(this.getUrl()) == false) return false; if (other.getAttachment() == null ^ this.getAttachment() == null) return false; if (other.getAttachment() != null && other.getAttachment().equals(this.getAttachment()) == false) return false; if (other.getString() == null ^ this.getString() == null) return false; if (other.getString() != null && other.getString().equals(this.getString()) == false) return false; if (other.getNumber() == null ^ this.getNumber() == null) return false; if (other.getNumber() != null && other.getNumber().equals(this.getNumber()) == false) return false; if (other.getDate() == null ^ this.getDate() == null) return false; if (other.getDate() != null && other.getDate().equals(this.getDate()) == false) return false; if (other.getEmail() == null ^ this.getEmail() == null) return false; if (other.getEmail() != null && other.getEmail().equals(this.getEmail()) == false) return false; return true; } }