Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2010-2015 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.sqs.model;
 

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 SendMessage .

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).

 
 public class MessageAttributeValue implements SerializableCloneable {

    
Strings are Unicode with UTF8 binary encoding. For a list of code values, see http://en.wikipedia.org/wiki/ASCII#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;

    
Not implemented. Reserved for future use.
 
Not implemented. Reserved for future use.
 
Amazon SQS supports the following logical data types: String, Number, and Binary. In addition, you can append your own custom labels. 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 http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters.

Returns:
Strings are Unicode with UTF8 binary encoding. For a list of code values, see http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters.
 
     public String getStringValue() {
         return ;
     }
    
    
Strings are Unicode with UTF8 binary encoding. For a list of code values, see http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters.

Parameters:
stringValue Strings are Unicode with UTF8 binary encoding. For a list of code values, see http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters.
 
     public void setStringValue(String stringValue) {
         this. = stringValue;
     }
    
    
Strings are Unicode with UTF8 binary encoding. For a list of code values, see http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters.

Returns a reference to this object so that method calls can be chained together.

Parameters:
stringValue Strings are Unicode with UTF8 binary encoding. For a list of code values, see http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters.
Returns:
A reference to this updated object so that method calls can be chained together.
    public MessageAttributeValue withStringValue(String stringValue) {
        this. = stringValue;
        return this;
    }

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

Returns:
Binary type attributes can store any binary data, for example, compressed data, encrypted data, or images.
    public java.nio.ByteBuffer getBinaryValue() {
        return ;
    }
    
    
Binary type attributes can store any binary data, for example, compressed data, encrypted data, or images.

Parameters:
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;
    }
    
    
Binary type attributes can store any binary data, for example, compressed data, encrypted data, or images.

Returns a reference to this object so that method calls can be chained together.

Parameters:
binaryValue Binary type attributes can store any binary data, for example, compressed data, encrypted data, or images.
Returns:
A reference to this updated object so that method calls can be chained together.
    public MessageAttributeValue withBinaryValue(java.nio.ByteBuffer binaryValue) {
        this. = binaryValue;
        return this;
    }

    
Not implemented. Reserved for future use.

Returns:
Not implemented. Reserved for future use.
    public java.util.List<StringgetStringListValues() {
        if ( == null) {
              .setAutoConstruct(true);
        }
        return ;
    }
    
    
Not implemented. Reserved for future use.

Parameters:
stringListValues Not implemented. Reserved for future use.
    public void setStringListValues(java.util.Collection<StringstringListValues) {
        if (stringListValues == null) {
            this. = null;
            return;
        }
        com.amazonaws.internal.ListWithAutoConstructFlag<StringstringListValuesCopy = new com.amazonaws.internal.ListWithAutoConstructFlag<String>(stringListValues.size());
        stringListValuesCopy.addAll(stringListValues);
        this. = stringListValuesCopy;
    }
    
    
Not implemented. Reserved for future use.

NOTE: This method appends the values to the existing list (if any). Use setStringListValues(java.util.Collection) or withStringListValues(java.util.Collection) if you want to override the existing values.

Returns a reference to this object so that method calls can be chained together.

Parameters:
stringListValues Not implemented. Reserved for future use.
Returns:
A reference to this updated object so that method calls can be chained together.
    public MessageAttributeValue withStringListValues(String... stringListValues) {
        if (getStringListValues() == nullsetStringListValues(new java.util.ArrayList<String>(stringListValues.length));
        for (String value : stringListValues) {
            getStringListValues().add(value);
        }
        return this;
    }
    
    
Not implemented. Reserved for future use.

Returns a reference to this object so that method calls can be chained together.

Parameters:
stringListValues Not implemented. Reserved for future use.
Returns:
A reference to this updated object so that method calls can be chained together.
        if (stringListValues == null) {
            this. = null;
        } else {
            com.amazonaws.internal.ListWithAutoConstructFlag<StringstringListValuesCopy = new com.amazonaws.internal.ListWithAutoConstructFlag<String>(stringListValues.size());
            stringListValuesCopy.addAll(stringListValues);
            this. = stringListValuesCopy;
        }
        return this;
    }

    
Not implemented. Reserved for future use.

Returns:
Not implemented. Reserved for future use.
        if ( == null) {
              .setAutoConstruct(true);
        }
        return ;
    }
    
    
Not implemented. Reserved for future use.

Parameters:
binaryListValues Not implemented. Reserved for future use.
    public void setBinaryListValues(java.util.Collection<java.nio.ByteBufferbinaryListValues) {
        if (binaryListValues == null) {
            this. = null;
            return;
        }
        binaryListValuesCopy.addAll(binaryListValues);
        this. = binaryListValuesCopy;
    }
    
    
Not implemented. Reserved for future use.

NOTE: This method appends the values to the existing list (if any). Use setBinaryListValues(java.util.Collection) or withBinaryListValues(java.util.Collection) if you want to override the existing values.

Returns a reference to this object so that method calls can be chained together.

Parameters:
binaryListValues Not implemented. Reserved for future use.
Returns:
A reference to this updated object so that method calls can be chained together.
    public MessageAttributeValue withBinaryListValues(java.nio.ByteBuffer... binaryListValues) {
        if (getBinaryListValues() == nullsetBinaryListValues(new java.util.ArrayList<java.nio.ByteBuffer>(binaryListValues.length));
        for (java.nio.ByteBuffer value : binaryListValues) {
            getBinaryListValues().add(value);
        }
        return this;
    }
    
    
Not implemented. Reserved for future use.

Returns a reference to this object so that method calls can be chained together.

Parameters:
binaryListValues Not implemented. Reserved for future use.
Returns:
A reference to this updated object so that method calls can be chained together.
        if (binaryListValues == null) {
            this. = null;
        } else {
            com.amazonaws.internal.ListWithAutoConstructFlag<java.nio.ByteBufferbinaryListValuesCopy = new com.amazonaws.internal.ListWithAutoConstructFlag<java.nio.ByteBuffer>(binaryListValues.size());
            binaryListValuesCopy.addAll(binaryListValues);
            this. = binaryListValuesCopy;
        }
        return this;
    }

    
Amazon SQS supports the following logical data types: String, Number, and Binary. In addition, you can append your own custom labels. For more information, see Message Attribute Data Types.

Returns:
Amazon SQS supports the following logical data types: String, Number, and Binary. In addition, you can append your own custom labels. For more information, see Message Attribute Data Types.
    public String getDataType() {
        return ;
    }
    
    
Amazon SQS supports the following logical data types: String, Number, and Binary. In addition, you can append your own custom labels. For more information, see Message Attribute Data Types.

Parameters:
dataType Amazon SQS supports the following logical data types: String, Number, and Binary. In addition, you can append your own custom labels. For more information, see Message Attribute Data Types.
    public void setDataType(String dataType) {
        this. = dataType;
    }
    
    
Amazon SQS supports the following logical data types: String, Number, and Binary. In addition, you can append your own custom labels. For more information, see Message Attribute Data Types.

Returns a reference to this object so that method calls can be chained together.

Parameters:
dataType Amazon SQS supports the following logical data types: String, Number, and Binary. In addition, you can append your own custom labels. For more information, see Message Attribute Data Types.
Returns:
A reference to this updated object so that method calls can be chained together.
    public MessageAttributeValue withDataType(String dataType) {
        this. = dataType;
        return this;
    }

    
Returns a string representation of this object; useful for testing and debugging.

Returns:
A string representation of this object.
See also:
java.lang.Object.toString()
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getStringValue() != nullsb.append("StringValue: " + getStringValue() + ",");
        if (getBinaryValue() != nullsb.append("BinaryValue: " + getBinaryValue() + ",");
        if (getStringListValues() != nullsb.append("StringListValues: " + getStringListValues() + ",");
        if (getBinaryListValues() != nullsb.append("BinaryListValues: " + getBinaryListValues() + ",");
        if (getDataType() != nullsb.append("DataType: " + getDataType() );
        sb.append("}");
        return sb.toString();
    }
    
    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;
        
        hashCode = prime * hashCode + ((getStringValue() == null) ? 0 : getStringValue().hashCode()); 
        hashCode = prime * hashCode + ((getBinaryValue() == null) ? 0 : getBinaryValue().hashCode()); 
        hashCode = prime * hashCode + ((getStringListValues() == null) ? 0 : getStringListValues().hashCode()); 
        hashCode = prime * hashCode + ((getBinaryListValues() == null) ? 0 : getBinaryListValues().hashCode()); 
        hashCode = prime * hashCode + ((getDataType() == null) ? 0 : getDataType().hashCode()); 
        return hashCode;
    }
    
    @Override
    public boolean equals(Object obj) {
        if (this == objreturn true;
        if (obj == nullreturn false;
        if (obj instanceof MessageAttributeValue == falsereturn false;
        MessageAttributeValue other = (MessageAttributeValue)obj;
        
        if (other.getStringValue() == null ^ this.getStringValue() == nullreturn false;
        if (other.getStringValue() != null && other.getStringValue().equals(this.getStringValue()) == falsereturn false
        if (other.getBinaryValue() == null ^ this.getBinaryValue() == nullreturn false;
        if (other.getBinaryValue() != null && other.getBinaryValue().equals(this.getBinaryValue()) == falsereturn false
        if (other.getStringListValues() == null ^ this.getStringListValues() == nullreturn false;
        if (other.getStringListValues() != null && other.getStringListValues().equals(this.getStringListValues()) == falsereturn false
        if (other.getBinaryListValues() == null ^ this.getBinaryListValues() == nullreturn false;
        if (other.getBinaryListValues() != null && other.getBinaryListValues().equals(this.getBinaryListValues()) == falsereturn false
        if (other.getDataType() == null ^ this.getDataType() == nullreturn false;
        if (other.getDataType() != null && other.getDataType().equals(this.getDataType()) == falsereturn false
        return true;
    }
    
    @Override
    public MessageAttributeValue clone() {
        try {
            return (MessageAttributeValuesuper.clone();
        
        } catch (CloneNotSupportedException e) {
            throw new IllegalStateException(
                    "Got a CloneNotSupportedException from Object.clone() "
                    + "even though we're Cloneable!",
                    e);
        }
        
    }
}
    
New to GrepCode? Check out our FAQ X