static boolean isNullable(Invokable<?, ?> invokable) { return isNullable(invokable.getAnnotatedReturnType().getAnnotations()) || isNullable(invokable.getAnnotations()); }
public boolean apply(Invokable<?, ?> input) { return FluentIterable.from(Arrays.asList(input.getAnnotations())) .transform(new Function<Annotation, Class<? extends Annotation>>() { public Class<? extends Annotation> apply(Annotation input) { return input.annotationType(); } }).anyMatch(in(markers)); } };
public boolean apply(Invokable<?, ?> input) { return FluentIterable.from(Arrays.asList(input.getAnnotations())) .transform(new Function<Annotation, Class<? extends Annotation>>() { public Class<? extends Annotation> apply(Annotation input) { return input.annotationType(); } }).anyMatch(in(markers)); } };
public boolean apply(Invokable<?, ?> input) { return FluentIterable.from(Arrays.asList(input.getAnnotations())) .transform(new Function<Annotation, Class<? extends Annotation>>() { public Class<? extends Annotation> apply(Annotation input) { return input.annotationType(); } }).anyMatch((Predicate<Class<? extends Annotation>>) in(markers)); } };
public boolean apply(Invokable<?, ?> input) { return FluentIterable.from(Arrays.asList(input.getAnnotations())) .transform(new Function<Annotation, Class<? extends Annotation>>() { public Class<? extends Annotation> apply(Annotation input) { return input.annotationType(); } }).anyMatch(in(markers)); } };
public boolean apply(Invokable<?, ?> input) { return FluentIterable.from(Arrays.asList(input.getAnnotations())) .transform(new Function<Annotation, Class<? extends Annotation>>() { public Class<? extends Annotation> apply(Annotation input) { return input.annotationType(); } }).anyMatch((Predicate<Class<? extends Annotation>>) in(markers)); } };
public boolean apply(Invokable<?, ?> input) { return FluentIterable.from(Arrays.asList(input.getAnnotations())) .transform(new Function<Annotation, Class<? extends Annotation>>() { public Class<? extends Annotation> apply(Annotation input) { return input.annotationType(); } }).anyMatch((Predicate<Class<? extends Annotation>>) in(markers)); } };
public static Optional<String> tryFindHttpMethod(Invokable<?, ?> method) { Builder<String> methodsBuilder = ImmutableSet.builder(); for (Annotation annotation : method.getAnnotations()) { HttpMethod http = annotation.annotationType().getAnnotation(HttpMethod.class); if (http != null) methodsBuilder.add(http.value()); } Collection<String> methods = methodsBuilder.build(); switch (methods.size()) { case 0: return Optional.absent(); case 1: return Optional.of(get(methods, 0)); default: throw new IllegalStateException("You must specify at most one HttpMethod annotation on: " + method); } }
public static Optional<String> tryFindHttpMethod(Invokable<?, ?> method) { Builder<String> methodsBuilder = ImmutableSet.builder(); for (Annotation annotation : method.getAnnotations()) { HttpMethod http = annotation.annotationType().getAnnotation(HttpMethod.class); if (http != null) methodsBuilder.add(http.value()); } Collection<String> methods = methodsBuilder.build(); switch (methods.size()) { case 0: return Optional.absent(); case 1: return Optional.of(get(methods, 0)); default: throw new IllegalStateException("You must specify at most one HttpMethod annotation on: " + method); } }
public static Optional<String> tryFindHttpMethod(Invokable<?, ?> method) { Builder<String> methodsBuilder = ImmutableSet.builder(); for (Annotation annotation : method.getAnnotations()) { HttpMethod http = annotation.annotationType().getAnnotation(HttpMethod.class); if (http != null) methodsBuilder.add(http.value()); } Collection<String> methods = methodsBuilder.build(); switch (methods.size()) { case 0: return Optional.absent(); case 1: return Optional.of(get(methods, 0)); default: throw new IllegalStateException("You must specify at most one HttpMethod annotation on: " + method); } }
public static Optional<String> tryFindHttpMethod(Invokable<?, ?> method) { Builder<String> methodsBuilder = ImmutableSet.builder(); for (Annotation annotation : method.getAnnotations()) { HttpMethod http = annotation.annotationType().getAnnotation(HttpMethod.class); if (http != null) methodsBuilder.add(http.value()); } Collection<String> methods = methodsBuilder.build(); switch (methods.size()) { case 0: return Optional.absent(); case 1: return Optional.of(get(methods, 0)); default: throw new IllegalStateException("You must specify at most one HttpMethod annotation on: " + method); } }
public static Optional<String> tryFindHttpMethod(Invokable<?, ?> method) { Builder<String> methodsBuilder = ImmutableSet.builder(); for (Annotation annotation : method.getAnnotations()) { HttpMethod http = annotation.annotationType().getAnnotation(HttpMethod.class); if (http != null) methodsBuilder.add(http.value()); } Collection<String> methods = methodsBuilder.build(); switch (methods.size()) { case 0: return Optional.absent(); case 1: return Optional.of(get(methods, 0)); default: throw new IllegalStateException("You must specify at most one HttpMethod annotation on: " + method); } }
public static Optional<String> tryFindHttpMethod(Invokable<?, ?> method) { Builder<String> methodsBuilder = ImmutableSet.builder(); for (Annotation annotation : method.getAnnotations()) { HttpMethod http = annotation.annotationType().getAnnotation(HttpMethod.class); if (http != null) methodsBuilder.add(http.value()); } Collection<String> methods = methodsBuilder.build(); switch (methods.size()) { case 0: return Optional.absent(); case 1: return Optional.of(get(methods, 0)); default: throw new IllegalStateException("You must specify at most one HttpMethod annotation on: " + method); } }
private Object lookupValueFromGuice(Invokable<?, ?> invoked) { try { Type genericReturnType = invoked.getReturnType().getType(); try { Annotation qualifier = find(ImmutableList.copyOf(invoked.getAnnotations()), isQualifierPresent); return getInstanceOfTypeWithQualifier(genericReturnType, qualifier); } catch (ProvisionException e) { throw propagate(e.getCause()); } catch (RuntimeException e) { return instanceOfTypeOrPropagate(genericReturnType, e); } } catch (ProvisionException e) { AuthorizationException aex = getFirstThrowableOfType(e, AuthorizationException.class); if (aex != null) throw aex; throw e; } }
private Object lookupValueFromGuice(Invokable<?, ?> invoked) { try { Type genericReturnType = invoked.getReturnType().getType(); try { Annotation qualifier = find(ImmutableList.copyOf(invoked.getAnnotations()), isQualifierPresent); return getInstanceOfTypeWithQualifier(genericReturnType, qualifier); } catch (ProvisionException e) { throw propagate(e.getCause()); } catch (RuntimeException e) { return instanceOfTypeOrPropagate(genericReturnType, e); } } catch (ProvisionException e) { AuthorizationException aex = getFirstThrowableOfType(e, AuthorizationException.class); if (aex != null) throw aex; throw e; } }
private Object lookupValueFromGuice(Invokable<?, ?> invoked) { try { Type genericReturnType = invoked.getReturnType().getType(); try { Annotation qualifier = find(ImmutableList.copyOf(invoked.getAnnotations()), isQualifierPresent); return getInstanceOfTypeWithQualifier(genericReturnType, qualifier); } catch (ProvisionException e) { throw propagate(e.getCause()); } catch (RuntimeException e) { return instanceOfTypeOrPropagate(genericReturnType, e); } } catch (ProvisionException e) { AuthorizationException aex = getFirstThrowableOfType(e, AuthorizationException.class); if (aex != null) throw aex; throw e; } }
private Object lookupValueFromGuice(Invokable<?, ?> invoked) { try { Type genericReturnType = invoked.getReturnType().getType(); try { Annotation qualifier = find(ImmutableList.copyOf(invoked.getAnnotations()), isQualifierPresent); return getInstanceOfTypeWithQualifier(genericReturnType, qualifier); } catch (ProvisionException e) { throw propagate(e.getCause()); } catch (RuntimeException e) { return instanceOfTypeOrPropagate(genericReturnType, e); } } catch (ProvisionException e) { AuthorizationException aex = getFirstThrowableOfType(e, AuthorizationException.class); if (aex != null) throw aex; throw e; } }
private Object lookupValueFromGuice(Invokable<?, ?> invoked) { try { Type genericReturnType = invoked.getReturnType().getType(); try { Annotation qualifier = find(ImmutableList.copyOf(invoked.getAnnotations()), isQualifierPresent); return getInstanceOfTypeWithQualifier(genericReturnType, qualifier); } catch (ProvisionException e) { throw propagate(e.getCause()); } catch (RuntimeException e) { return instanceOfTypeOrPropagate(genericReturnType, e); } } catch (ProvisionException e) { AuthorizationException aex = getFirstThrowableOfType(e, AuthorizationException.class); if (aex != null) throw aex; throw e; } }
private Object lookupValueFromGuice(Invokable<?, ?> invoked) { try { Type genericReturnType = invoked.getReturnType().getType(); try { Annotation qualifier = find(ImmutableList.copyOf(invoked.getAnnotations()), isQualifierPresent); return getInstanceOfTypeWithQualifier(genericReturnType, qualifier); } catch (ProvisionException e) { throw propagate(e.getCause()); } catch (RuntimeException e) { return instanceOfTypeOrPropagate(genericReturnType, e); } } catch (ProvisionException e) { AuthorizationException aex = getFirstThrowableOfType(e, AuthorizationException.class); if (aex != null) throw aex; throw e; } }
static boolean isNullable(Invokable<?, ?> invokable) { return isNullable(invokable.getAnnotatedReturnType().getAnnotations()) || isNullable(invokable.getAnnotations()); }