Start line:  
End line:  

Snippet Preview

Snippet HTML Code

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

Represents the data for an attribute. You can set one, and only one, of the elements.

 
 public class AttributeValue implements Serializable {

    
A String data type
 
     private String s;

    
A Number data type
 
     private String n;

    
A Binary data type
 
     private java.nio.ByteBuffer b;

    
A String set data type
 
Number set data type
 
A Binary set data type
 
Default constructor for a new AttributeValue object. Callers should use the setter or fluent setter (with...) methods to initialize this object after creating it.
 
     public AttributeValue() {}
    
    
Constructs a new AttributeValue object. Callers should use the setter or fluent setter (with...) methods to initialize any additional object members.

Parameters:
s A String data type
 
     public AttributeValue(String s) {
         setS(s);
     }

    
Constructs a new AttributeValue object. Callers should use the setter or fluent setter (with...) methods to initialize any additional object members.

Parameters:
sS A String set data type
 
     public AttributeValue(java.util.List<StringsS) {
         setSS(sS);
     }

    
A String data type

Returns:
A String data type
 
     public String getS() {
         return ;
     }
    
    
A String data type

Parameters:
s A String data type
 
     public void setS(String s) {
        this. = s;
    }
    
    
A String data type

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

Parameters:
s A String data type
Returns:
A reference to this updated object so that method calls can be chained together.
    public AttributeValue withS(String s) {
        this. = s;
        return this;
    }

    
A Number data type

Returns:
A Number data type
    public String getN() {
        return ;
    }
    
    
A Number data type

Parameters:
n A Number data type
    public void setN(String n) {
        this. = n;
    }
    
    
A Number data type

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

Parameters:
n A Number data type
Returns:
A reference to this updated object so that method calls can be chained together.
    public AttributeValue withN(String n) {
        this. = n;
        return this;
    }

    
A Binary data type

Returns:
A Binary data type
    public java.nio.ByteBuffer getB() {
        return ;
    }
    
    
A Binary data type

Parameters:
b A Binary data type
    public void setB(java.nio.ByteBuffer b) {
        this. = b;
    }
    
    
A Binary data type

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

Parameters:
b A Binary data type
Returns:
A reference to this updated object so that method calls can be chained together.
    public AttributeValue withB(java.nio.ByteBuffer b) {
        this. = b;
        return this;
    }

    
A String set data type

Returns:
A String set data type
    public java.util.List<StringgetSS() {
        return ;
    }
    
    
A String set data type

Parameters:
sS A String set data type
    public void setSS(java.util.Collection<StringsS) {
        if (sS == null) {
            this. = null;
            return;
        }
        sSCopy.addAll(sS);
        this. = sSCopy;
    }
    
    
A String set data type

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

Parameters:
sS A String set data type
Returns:
A reference to this updated object so that method calls can be chained together.
    public AttributeValue withSS(String... sS) {
        if (getSS() == nullsetSS(new java.util.ArrayList<String>(sS.length));
        for (String value : sS) {
            getSS().add(value);
        }
        return this;
    }
    
    
A String set data type

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

Parameters:
sS A String set data type
Returns:
A reference to this updated object so that method calls can be chained together.
        if (sS == null) {
            this. = null;
        } else {
            sSCopy.addAll(sS);
            this. = sSCopy;
        }
        return this;
    }

    
Number set data type

Returns:
Number set data type
    public java.util.List<StringgetNS() {
        return ;
    }
    
    
Number set data type

Parameters:
nS Number set data type
    public void setNS(java.util.Collection<StringnS) {
        if (nS == null) {
            this. = null;
            return;
        }
        nSCopy.addAll(nS);
        this. = nSCopy;
    }
    
    
Number set data type

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

Parameters:
nS Number set data type
Returns:
A reference to this updated object so that method calls can be chained together.
    public AttributeValue withNS(String... nS) {
        if (getNS() == nullsetNS(new java.util.ArrayList<String>(nS.length));
        for (String value : nS) {
            getNS().add(value);
        }
        return this;
    }
    
    
Number set data type

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

Parameters:
nS Number set data type
Returns:
A reference to this updated object so that method calls can be chained together.
        if (nS == null) {
            this. = null;
        } else {
            nSCopy.addAll(nS);
            this. = nSCopy;
        }
        return this;
    }

    
A Binary set data type

Returns:
A Binary set data type
    public java.util.List<java.nio.ByteBuffergetBS() {
        return ;
    }
    
    
A Binary set data type

Parameters:
bS A Binary set data type
    public void setBS(java.util.Collection<java.nio.ByteBufferbS) {
        if (bS == null) {
            this. = null;
            return;
        }
        bSCopy.addAll(bS);
        this. = bSCopy;
    }
    
    
A Binary set data type

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

Parameters:
bS A Binary set data type
Returns:
A reference to this updated object so that method calls can be chained together.
    public AttributeValue withBS(java.nio.ByteBuffer... bS) {
        if (getBS() == nullsetBS(new java.util.ArrayList<java.nio.ByteBuffer>(bS.length));
        for (java.nio.ByteBuffer value : bS) {
            getBS().add(value);
        }
        return this;
    }
    
    
A Binary set data type

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

Parameters:
bS A Binary set data type
Returns:
A reference to this updated object so that method calls can be chained together.
        if (bS == null) {
            this. = null;
        } else {
            bSCopy.addAll(bS);
            this. = bSCopy;
        }
        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 (getS() != nullsb.append("S: " + getS() + ",");
        if (getN() != nullsb.append("N: " + getN() + ",");
        if (getB() != nullsb.append("B: " + getB() + ",");
        if (getSS() != nullsb.append("SS: " + getSS() + ",");
        if (getNS() != nullsb.append("NS: " + getNS() + ",");
        if (getBS() != nullsb.append("BS: " + getBS() );
        sb.append("}");
        return sb.toString();
    }
    
    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;
        
        hashCode = prime * hashCode + ((getS() == null) ? 0 : getS().hashCode()); 
        hashCode = prime * hashCode + ((getN() == null) ? 0 : getN().hashCode()); 
        hashCode = prime * hashCode + ((getB() == null) ? 0 : getB().hashCode()); 
        hashCode = prime * hashCode + ((getSS() == null) ? 0 : getSS().hashCode()); 
        hashCode = prime * hashCode + ((getNS() == null) ? 0 : getNS().hashCode()); 
        hashCode = prime * hashCode + ((getBS() == null) ? 0 : getBS().hashCode()); 
        return hashCode;
    }
    
    @Override
    public boolean equals(Object obj) {
        if (this == objreturn true;
        if (obj == nullreturn false;
        if (obj instanceof AttributeValue == falsereturn false;
        AttributeValue other = (AttributeValue)obj;
        
        if (other.getS() == null ^ this.getS() == nullreturn false;
        if (other.getS() != null && other.getS().equals(this.getS()) == falsereturn false
        if (other.getN() == null ^ this.getN() == nullreturn false;
        if (other.getN() != null && other.getN().equals(this.getN()) == falsereturn false
        if (other.getB() == null ^ this.getB() == nullreturn false;
        if (other.getB() != null && other.getB().equals(this.getB()) == falsereturn false
        if (other.getSS() == null ^ this.getSS() == nullreturn false;
        if (other.getSS() != null && other.getSS().equals(this.getSS()) == falsereturn false
        if (other.getNS() == null ^ this.getNS() == nullreturn false;
        if (other.getNS() != null && other.getNS().equals(this.getNS()) == falsereturn false
        if (other.getBS() == null ^ this.getBS() == nullreturn false;
        if (other.getBS() != null && other.getBS().equals(this.getBS()) == falsereturn false
        return true;
    }
    
}
    
New to GrepCode? Check out our FAQ X