Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2014-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.s3.model;
 
 import java.util.Map;

Used to provide additional/supplemental material description (typically on a per-request basis and for more advanced use-case) to supplement the one stored in S3 for crypto material retrieval.
 
 public class ExtraMaterialsDescription {
     @SuppressWarnings("unchecked")
     public static final ExtraMaterialsDescription NONE =
         new ExtraMaterialsDescription(.);

    
Used to resolve conflicts when merging the additional material description to the core material description.
 
     public static enum ConflictResolution {
        
Fail fast upon conflicting keys.
 
         FAIL_FAST,
        
Take precedence upon conflicting keys.
 
         OVERRIDE,
        
To be overridden upon conflicting keys.
 
         OVERRIDDEN,
         ;
     }
    
Supplemental material descriptions which are unmodifiable.
 
     private final Map<String,Stringextra;
    
Resolution behavior when there are overlapping entries. Defaults to ExtraMaterialsDescription.ConflictResolution.FAIL_FAST.
 
     private final ConflictResolution resolve;
 
     public ExtraMaterialsDescription(Map<String,Stringmatdesc) {
         this(matdesc.);
     }
 
     public ExtraMaterialsDescription(Map<StringStringmatdesc,
             ConflictResolution resolve) {
         if (matdesc == null || resolve == null)
             throw new IllegalArgumentException();
         this. = Collections.unmodifiableMap(
             new HashMap<StringString>(matdesc));
         this. = resolve;
     }

    
Returns the extra material description; never null.
 
     public Map<StringStringgetMaterialDescription() {
         return ;
     }

    
Returns the conflict resolution strategy; neve null.
 
         return ;
     }

    
Combine this supplemental material descriptions with those specified in the "core" parameter. This method has no side effect.

Parameters:
core the core material descriptions to be supplemented; assumed to be unmodifiable.
Returns:
the merged material descriptions; never null. The returned map is always unmodifiable, assuming the passed in core material descriptions are unmodifiable.
Throws:
java.lang.IllegalArgumentException if this supplemental material descriptions contains conflicting entries
java.lang.UnsupportedOperationException if the conflict resolution strategy is not supported
 
     public Map<StringStringmergeInto(Map<StringStringcore) {
         if (.size() == 0)
            return core;    // no supplemental descriptions
        if (core == null || core.size() == 0)
            return ;   // only core descriptions
        switch() {
            case : {
                final int total = core.size() + .size();
                Map<StringStringmerged = new HashMap<String,String>(core);
                merged.putAll();
                if (total != merged.size()) {
                    throw new IllegalArgumentException(
                        "The supplemental material descriptions contains conflicting entries");
                }
                return Collections.unmodifiableMap(merged);
            }
            case : {
                Map<String,Stringmerged = new HashMap<String,String>();
                merged.putAll(core);
                return Collections.unmodifiableMap(merged);
            }
            case : {
                Map<String,Stringmerged = new HashMap<String,String>(core);
                merged.putAll();
                return Collections.unmodifiableMap(merged);
            }
            default:
                throw new UnsupportedOperationException();
        }
    }
New to GrepCode? Check out our FAQ X