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

com.amazonaws.services.sns.model.MessageAttributeValue Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Amazon SNS module holds the client classes that are used for communicating with Amazon Simple Notification Service

There is a newer version: 1.12.778
Show newest version
/*
 * Copyright 2019-2024 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.sns.model;

import java.io.Serializable;
import javax.annotation.Generated;

/**
 * 

* The user-specified message attribute value. For string data types, the value attribute has the same restrictions on * the content as the message body. For more information, see Publish. *

*

* Name, type, and value must not be empty or null. In addition, the message body should not be empty or null. All parts * of the message attribute, including name, type, and value, are included in the message size restriction, which is * currently 256 KB (262,144 bytes). For more information, see Amazon SNS message attributes and Publishing to a mobile phone in the * Amazon SNS Developer Guide. *

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

* Amazon SNS supports the following logical data types: String, String.Array, Number, and Binary. For more * information, see Message * Attribute Data Types. *

*/ private String dataType; /** *

* Strings are Unicode with UTF8 binary encoding. For a list of code values, see ASCII Printable Characters. *

*/ private String stringValue; /** *

* Binary type attributes can store any binary data, for example, compressed data, encrypted data, or images. *

*/ private java.nio.ByteBuffer binaryValue; /** *

* Amazon SNS supports the following logical data types: String, String.Array, Number, and Binary. For more * information, see Message * Attribute Data Types. *

* * @param dataType * Amazon SNS supports the following logical data types: String, String.Array, Number, and Binary. For more * information, see Message Attribute Data Types. */ public void setDataType(String dataType) { this.dataType = dataType; } /** *

* Amazon SNS supports the following logical data types: String, String.Array, Number, and Binary. For more * information, see Message * Attribute Data Types. *

* * @return Amazon SNS supports the following logical data types: String, String.Array, Number, and Binary. For more * information, see Message Attribute Data Types. */ public String getDataType() { return this.dataType; } /** *

* Amazon SNS supports the following logical data types: String, String.Array, Number, and Binary. For more * information, see Message * Attribute Data Types. *

* * @param dataType * Amazon SNS supports the following logical data types: String, String.Array, Number, and Binary. For more * information, see Message Attribute Data Types. * @return Returns a reference to this object so that method calls can be chained together. */ public MessageAttributeValue withDataType(String dataType) { setDataType(dataType); return this; } /** *

* Strings are Unicode with UTF8 binary encoding. For a list of code values, see ASCII Printable Characters. *

* * @param stringValue * Strings are Unicode with UTF8 binary encoding. For a list of code values, see ASCII Printable Characters. */ public void setStringValue(String stringValue) { this.stringValue = stringValue; } /** *

* Strings are Unicode with UTF8 binary encoding. For a list of code values, see ASCII Printable Characters. *

* * @return Strings are Unicode with UTF8 binary encoding. For a list of code values, see ASCII Printable Characters. */ public String getStringValue() { return this.stringValue; } /** *

* Strings are Unicode with UTF8 binary encoding. For a list of code values, see ASCII Printable Characters. *

* * @param stringValue * Strings are Unicode with UTF8 binary encoding. For a list of code values, see ASCII Printable Characters. * @return Returns a reference to this object so that method calls can be chained together. */ public MessageAttributeValue withStringValue(String stringValue) { setStringValue(stringValue); return this; } /** *

* Binary type attributes can store any binary data, for example, compressed data, encrypted data, or images. *

*

* The AWS SDK for Java performs a Base64 encoding on this field before sending this request to the AWS service. * Users of the SDK should not perform Base64 encoding on this field. *

*

* Warning: ByteBuffers returned by the SDK are mutable. Changes to the content or position of the byte buffer will * be seen by all objects that have a reference to this object. It is recommended to call ByteBuffer.duplicate() or * ByteBuffer.asReadOnlyBuffer() before using or reading from the buffer. This behavior will be changed in a future * major version of the SDK. *

* * @param binaryValue * Binary type attributes can store any binary data, for example, compressed data, encrypted data, or images. */ public void setBinaryValue(java.nio.ByteBuffer binaryValue) { this.binaryValue = binaryValue; } /** *

* Binary type attributes can store any binary data, for example, compressed data, encrypted data, or images. *

*

* {@code ByteBuffer}s are stateful. Calling their {@code get} methods changes their {@code position}. We recommend * using {@link java.nio.ByteBuffer#asReadOnlyBuffer()} to create a read-only view of the buffer with an independent * {@code position}, and calling {@code get} methods on this rather than directly on the returned {@code ByteBuffer}. * Doing so will ensure that anyone else using the {@code ByteBuffer} will not be affected by changes to the * {@code position}. *

* * @return Binary type attributes can store any binary data, for example, compressed data, encrypted data, or * images. */ public java.nio.ByteBuffer getBinaryValue() { return this.binaryValue; } /** *

* Binary type attributes can store any binary data, for example, compressed data, encrypted data, or images. *

*

* The AWS SDK for Java performs a Base64 encoding on this field before sending this request to the AWS service. * Users of the SDK should not perform Base64 encoding on this field. *

*

* Warning: ByteBuffers returned by the SDK are mutable. Changes to the content or position of the byte buffer will * be seen by all objects that have a reference to this object. It is recommended to call ByteBuffer.duplicate() or * ByteBuffer.asReadOnlyBuffer() before using or reading from the buffer. This behavior will be changed in a future * major version of the SDK. *

* * @param binaryValue * Binary type attributes can store any binary data, for example, compressed data, encrypted data, or images. * @return Returns a reference to this object so that method calls can be chained together. */ public MessageAttributeValue withBinaryValue(java.nio.ByteBuffer binaryValue) { setBinaryValue(binaryValue); 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 (getDataType() != null) sb.append("DataType: ").append(getDataType()).append(","); if (getStringValue() != null) sb.append("StringValue: ").append(getStringValue()).append(","); if (getBinaryValue() != null) sb.append("BinaryValue: ").append(getBinaryValue()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof MessageAttributeValue == false) return false; MessageAttributeValue other = (MessageAttributeValue) obj; if (other.getDataType() == null ^ this.getDataType() == null) return false; if (other.getDataType() != null && other.getDataType().equals(this.getDataType()) == false) return false; if (other.getStringValue() == null ^ this.getStringValue() == null) return false; if (other.getStringValue() != null && other.getStringValue().equals(this.getStringValue()) == false) return false; if (other.getBinaryValue() == null ^ this.getBinaryValue() == null) return false; if (other.getBinaryValue() != null && other.getBinaryValue().equals(this.getBinaryValue()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getDataType() == null) ? 0 : getDataType().hashCode()); hashCode = prime * hashCode + ((getStringValue() == null) ? 0 : getStringValue().hashCode()); hashCode = prime * hashCode + ((getBinaryValue() == null) ? 0 : getBinaryValue().hashCode()); return hashCode; } @Override public MessageAttributeValue clone() { try { return (MessageAttributeValue) super.clone(); } catch (CloneNotSupportedException e) { throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e); } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy