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

Contains constraints on the grant.

 
 public class GrantConstraints implements SerializableCloneable {

    
The constraint equals the full encryption context.
 
     private java.util.Map<String,StringencryptionContextSubset;

    
The constraint contains additional key/value pairs that serve to further limit the grant.
 
     private java.util.Map<String,StringencryptionContextEquals;

    
The constraint equals the full encryption context.

Returns:
The constraint equals the full encryption context.
 
         
         if ( == null) {
              = new java.util.HashMap<String,String>();
         }
         return ;
     }
    
    
The constraint equals the full encryption context.

Parameters:
encryptionContextSubset The constraint equals the full encryption context.
 
     public void setEncryptionContextSubset(java.util.Map<String,StringencryptionContextSubset) {
         this. = encryptionContextSubset;
     }
    
    
The constraint equals the full encryption context.

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

Parameters:
encryptionContextSubset The constraint equals the full encryption context.
Returns:
A reference to this updated object so that method calls can be chained together.
 
     public GrantConstraints withEncryptionContextSubset(java.util.Map<String,StringencryptionContextSubset) {
         setEncryptionContextSubset(encryptionContextSubset);
         return this;
     }

    
The constraint equals the full encryption context.

The method adds a new key-value pair into EncryptionContextSubset parameter, and returns a reference to this object so that method calls can be chained together.

Parameters:
key The key of the entry to be added into EncryptionContextSubset.
value The corresponding value of the entry to be added into EncryptionContextSubset.
 
     if (null == this.) {
       this. = new java.util.HashMap<String,String>();
     }
     if (this..containsKey(key))
       throw new IllegalArgumentException("Duplicated keys (" + key.toString() + ") are provided.");
     this..put(keyvalue);
     return this;
   }

  
Removes all the entries added into EncryptionContextSubset.

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

 
    this. = null;
    return this;
  }
  
    
The constraint contains additional key/value pairs that serve to further limit the grant.

Returns:
The constraint contains additional key/value pairs that serve to further limit the grant.
        
        if ( == null) {
             = new java.util.HashMap<String,String>();
        }
        return ;
    }
    
    
The constraint contains additional key/value pairs that serve to further limit the grant.

Parameters:
encryptionContextEquals The constraint contains additional key/value pairs that serve to further limit the grant.
    public void setEncryptionContextEquals(java.util.Map<String,StringencryptionContextEquals) {
        this. = encryptionContextEquals;
    }
    
    
The constraint contains additional key/value pairs that serve to further limit the grant.

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

Parameters:
encryptionContextEquals The constraint contains additional key/value pairs that serve to further limit the grant.
Returns:
A reference to this updated object so that method calls can be chained together.
    public GrantConstraints withEncryptionContextEquals(java.util.Map<String,StringencryptionContextEquals) {
        setEncryptionContextEquals(encryptionContextEquals);
        return this;
    }

    
The constraint contains additional key/value pairs that serve to further limit the grant.

The method adds a new key-value pair into EncryptionContextEquals parameter, and returns a reference to this object so that method calls can be chained together.

Parameters:
key The key of the entry to be added into EncryptionContextEquals.
value The corresponding value of the entry to be added into EncryptionContextEquals.
    if (null == this.) {
    }
    if (this..containsKey(key))
      throw new IllegalArgumentException("Duplicated keys (" + key.toString() + ") are provided.");
    this..put(keyvalue);
    return this;
  }

  
Removes all the entries added into EncryptionContextEquals.

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

    this. = null;
    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 (getEncryptionContextSubset() != nullsb.append("EncryptionContextSubset: " + getEncryptionContextSubset() + ",");
        if (getEncryptionContextEquals() != nullsb.append("EncryptionContextEquals: " + getEncryptionContextEquals() );
        sb.append("}");
        return sb.toString();
    }
    
    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;
        
        hashCode = prime * hashCode + ((getEncryptionContextSubset() == null) ? 0 : getEncryptionContextSubset().hashCode()); 
        hashCode = prime * hashCode + ((getEncryptionContextEquals() == null) ? 0 : getEncryptionContextEquals().hashCode()); 
        return hashCode;
    }
    
    @Override
    public boolean equals(Object obj) {
        if (this == objreturn true;
        if (obj == nullreturn false;
        if (obj instanceof GrantConstraints == falsereturn false;
        GrantConstraints other = (GrantConstraints)obj;
        
        if (other.getEncryptionContextSubset() == null ^ this.getEncryptionContextSubset() == nullreturn false;
        if (other.getEncryptionContextSubset() != null && other.getEncryptionContextSubset().equals(this.getEncryptionContextSubset()) == falsereturn false
        if (other.getEncryptionContextEquals() == null ^ this.getEncryptionContextEquals() == nullreturn false;
        if (other.getEncryptionContextEquals() != null && other.getEncryptionContextEquals().equals(this.getEncryptionContextEquals()) == falsereturn false
        return true;
    }
    
    @Override
    public GrantConstraints clone() {
        try {
            return (GrantConstraintssuper.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