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.cognitoidentity.model;
 

Credentials for the the provided identity ID.

 
 public class Credentials implements SerializableCloneable {

    
The Access Key portion of the credentials.
 
     private String accessKeyId;

    
The Secret Access Key portion of the credentials
 
     private String secretKey;

    
The Session Token portion of the credentials
 
     private String sessionToken;

    
The date at which these credentials will expire.
 
     private java.util.Date expiration;

    
The Access Key portion of the credentials.

Returns:
The Access Key portion of the credentials.
 
     public String getAccessKeyId() {
         return ;
     }
    
    
The Access Key portion of the credentials.

Parameters:
accessKeyId The Access Key portion of the credentials.
 
     public void setAccessKeyId(String accessKeyId) {
         this. = accessKeyId;
     }
    
    
The Access Key portion of the credentials.

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

Parameters:
accessKeyId The Access Key portion of the credentials.
Returns:
A reference to this updated object so that method calls can be chained together.
 
     public Credentials withAccessKeyId(String accessKeyId) {
         this. = accessKeyId;
         return this;
     }

    
The Secret Access Key portion of the credentials

Returns:
The Secret Access Key portion of the credentials
 
     public String getSecretKey() {
         return ;
     }
    
    
The Secret Access Key portion of the credentials

Parameters:
secretKey The Secret Access Key portion of the credentials
 
     public void setSecretKey(String secretKey) {
         this. = secretKey;
     }
    
    
The Secret Access Key portion of the credentials

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

Parameters:
secretKey The Secret Access Key portion of the credentials
Returns:
A reference to this updated object so that method calls can be chained together.
    public Credentials withSecretKey(String secretKey) {
        this. = secretKey;
        return this;
    }

    
The Session Token portion of the credentials

Returns:
The Session Token portion of the credentials
    public String getSessionToken() {
        return ;
    }
    
    
The Session Token portion of the credentials

Parameters:
sessionToken The Session Token portion of the credentials
    public void setSessionToken(String sessionToken) {
        this. = sessionToken;
    }
    
    
The Session Token portion of the credentials

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

Parameters:
sessionToken The Session Token portion of the credentials
Returns:
A reference to this updated object so that method calls can be chained together.
    public Credentials withSessionToken(String sessionToken) {
        this. = sessionToken;
        return this;
    }

    
The date at which these credentials will expire.

Returns:
The date at which these credentials will expire.
    public java.util.Date getExpiration() {
        return ;
    }
    
    
The date at which these credentials will expire.

Parameters:
expiration The date at which these credentials will expire.
    public void setExpiration(java.util.Date expiration) {
        this. = expiration;
    }
    
    
The date at which these credentials will expire.

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

Parameters:
expiration The date at which these credentials will expire.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Credentials withExpiration(java.util.Date expiration) {
        this. = expiration;
        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 (getAccessKeyId() != nullsb.append("AccessKeyId: " + getAccessKeyId() + ",");
        if (getSecretKey() != nullsb.append("SecretKey: " + getSecretKey() + ",");
        if (getSessionToken() != nullsb.append("SessionToken: " + getSessionToken() + ",");
        if (getExpiration() != nullsb.append("Expiration: " + getExpiration() );
        sb.append("}");
        return sb.toString();
    }
    
    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;
        
        hashCode = prime * hashCode + ((getAccessKeyId() == null) ? 0 : getAccessKeyId().hashCode()); 
        hashCode = prime * hashCode + ((getSecretKey() == null) ? 0 : getSecretKey().hashCode()); 
        hashCode = prime * hashCode + ((getSessionToken() == null) ? 0 : getSessionToken().hashCode()); 
        hashCode = prime * hashCode + ((getExpiration() == null) ? 0 : getExpiration().hashCode()); 
        return hashCode;
    }
    
    @Override
    public boolean equals(Object obj) {
        if (this == objreturn true;
        if (obj == nullreturn false;
        if (obj instanceof Credentials == falsereturn false;
        Credentials other = (Credentials)obj;
        
        if (other.getAccessKeyId() == null ^ this.getAccessKeyId() == nullreturn false;
        if (other.getAccessKeyId() != null && other.getAccessKeyId().equals(this.getAccessKeyId()) == falsereturn false
        if (other.getSecretKey() == null ^ this.getSecretKey() == nullreturn false;
        if (other.getSecretKey() != null && other.getSecretKey().equals(this.getSecretKey()) == falsereturn false
        if (other.getSessionToken() == null ^ this.getSessionToken() == nullreturn false;
        if (other.getSessionToken() != null && other.getSessionToken().equals(this.getSessionToken()) == falsereturn false
        if (other.getExpiration() == null ^ this.getExpiration() == nullreturn false;
        if (other.getExpiration() != null && other.getExpiration().equals(this.getExpiration()) == falsereturn false
        return true;
    }
    
    @Override
    public Credentials clone() {
        try {
            return (Credentialssuper.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