Annotation[][] annotations = method.getParameterAnnotations();
String[] keyMappings = new String[annotations.length];
boolean keyMappingFound = false;
Map<String, Integer> unique = Maps.newHashMap();
for (int i = 0; i < annotations.length; i++) {
PartitionKey annotation = findPartitionKeyAnnotation(annotations[i]);
if (annotation == null) {
continue;
}
String key = checkNotNull(annotation.value());
Integer prev = unique.put(key, i);
checkState(prev == null, "Method '%s' has multiple arguments annotated with the same @PartitionKey " +
"value '%s': arguments %s and %s", method, key, prev, i);
keyMappings[i] = key;
keyMappingFound = true;