private List<String> retrieveEntityIdsFromArguments(final Method method, final Object[] args) { final Annotation[][] parameterAnnotations = getAnnotations(method); int i = -1; for (final Object arg : args) { i++; // Assume the first argument of type Entity is our type of Entity (type U here) // This is true for e.g. create calls if (arg instanceof Entity) { return ImmutableList.<String>of(((Entity) arg).getId().toString()); } // For Batch calls, the first argument will be of type List<Entity> if (arg instanceof Iterable) { final Builder<String> entityIds = extractEntityIdsFromBatchArgument((Iterable) arg); if (entityIds != null) { return entityIds.build(); } } for (final Annotation annotation : parameterAnnotations[i]) { if (arg instanceof String && Bind.class.equals(annotation.annotationType()) && ("id").equals(((Bind) annotation).value())) { return ImmutableList.<String>of((String) arg); } else if (arg instanceof Collection && BindIn.class.equals(annotation.annotationType()) && ("ids").equals(((BindIn) annotation).value())) { return ImmutableList.<String>copyOf((Collection) arg); } } } return ImmutableList.<String>of(); }
final Annotation[][] annotations = getAnnotations(method); for (int i = 0; i < annotations.length; i++) { for (int j = 0; j < annotations[i].length; j++) {
private List<String> retrieveEntityIdsFromArguments(final Method method, final Object[] args) { final Annotation[][] parameterAnnotations = getAnnotations(method); int i = -1; for (final Object arg : args) { i++; // Assume the first argument of type Entity is our type of Entity (type U here) // This is true for e.g. create calls if (arg instanceof Entity) { return ImmutableList.<String>of(((Entity) arg).getId().toString()); } // For Batch calls, the first argument will be of type List<Entity> if (arg instanceof Iterable) { final Builder<String> entityIds = extractEntityIdsFromBatchArgument((Iterable) arg); if (entityIds != null) { return entityIds.build(); } } for (final Annotation annotation : parameterAnnotations[i]) { if (arg instanceof String && Bind.class.equals(annotation.annotationType()) && ("id").equals(((Bind) annotation).value())) { return ImmutableList.<String>of((String) arg); } else if (arg instanceof Collection && BindIn.class.equals(annotation.annotationType()) && ("ids").equals(((BindIn) annotation).value())) { return ImmutableList.<String>copyOf((Collection) arg); } } } return ImmutableList.<String>of(); }
final Annotation[][] annotations = getAnnotations(method); for (int i = 0; i < annotations.length; i++) { for (int j = 0; j < annotations[i].length; j++) {