/** * Returns an array indexed by argument index with the value of the @PartitionKey annotation for each argument, * or null if no arguments are annotated with @PartitionKey. */ private String[] collectPartitionKeyAnnotations(Method method) { 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; } return keyMappingFound ? keyMappings : null; }
/** * Returns an array indexed by argument index with the value of the @PartitionKey annotation for each argument, * or null if no arguments are annotated with @PartitionKey. */ private String[] collectPartitionKeyAnnotations(Method method) { 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; } return keyMappingFound ? keyMappings : null; }