static boolean isNullable(Parameter param) { return isNullable(param.getAnnotatedType().getAnnotations()) || isNullable(param.getAnnotations()); }
public void testInstanceMethod_parameters() throws Exception { Invokable<?, ?> delegate = Prepender.method("prepend", Iterable.class); ImmutableList<Parameter> parameters = delegate.getParameters(); assertEquals(1, parameters.size()); assertEquals(new TypeToken<Iterable<String>>() {}, parameters.get(0).getType()); assertThat(parameters.get(0).getAnnotations()).isEmpty(); new EqualsTester().addEqualityGroup(parameters.get(0)).testEquals(); }
public static String getBucketName(HttpRequest req) { checkArgument(req instanceof GeneratedHttpRequest, "this should be a generated http request"); GeneratedHttpRequest request = GeneratedHttpRequest.class.cast(req); String bucketName = null; List<Parameter> parameters = Reflection2.getInvokableParameters(request.getInvocation().getInvokable()); for (int i = 0; i < parameters.size(); i++) { if (any(Arrays.asList(parameters.get(i).getAnnotations()), ANNOTATIONTYPE_BUCKET)) { bucketName = (String) request.getInvocation().getArgs().get(i); break; } } return bucketName; }
public static String getBucketName(HttpRequest req) { checkArgument(req instanceof GeneratedHttpRequest, "this should be a generated http request"); GeneratedHttpRequest request = GeneratedHttpRequest.class.cast(req); String bucketName = null; List<Parameter> parameters = Reflection2.getInvokableParameters(request.getInvocation().getInvokable()); for (int i = 0; i < parameters.size(); i++) { if (any(Arrays.asList(parameters.get(i).getAnnotations()), ANNOTATIONTYPE_BUCKET)) { bucketName = (String) request.getInvocation().getArgs().get(i); break; } } return bucketName; }
public static String getBucketName(HttpRequest req) { checkArgument(req instanceof GeneratedHttpRequest, "this should be a generated http request"); GeneratedHttpRequest request = GeneratedHttpRequest.class.cast(req); String bucketName = null; List<Parameter> parameters = Reflection2.getInvokableParameters(request.getInvocation().getInvokable()); for (int i = 0; i < parameters.size(); i++) { if (any(Arrays.asList(parameters.get(i).getAnnotations()), ANNOTATIONTYPE_BUCKET)) { bucketName = (String) request.getInvocation().getArgs().get(i); break; } } return bucketName; }
@VisibleForTesting <T> String translateName(Invokable<T, T> c, int index) { String name = null; if (markers.contains(ConstructorProperties.class) && c.getAnnotation(ConstructorProperties.class) != null) { String[] names = c.getAnnotation(ConstructorProperties.class).value(); if (names != null && names.length > index) { name = names[index]; } } for (Annotation annotation : c.getParameters().get(index).getAnnotations()) { if (annotationToNameExtractor.containsKey(annotation.annotationType())) { name = annotationToNameExtractor.get(annotation.annotationType()).apply(annotation); break; } } return name; } }
@VisibleForTesting <T> String translateName(Invokable<T, T> c, int index) { String name = null; if (markers.contains(ConstructorProperties.class) && c.getAnnotation(ConstructorProperties.class) != null) { String[] names = c.getAnnotation(ConstructorProperties.class).value(); if (names != null && names.length > index) { name = names[index]; } } for (Annotation annotation : c.getParameters().get(index).getAnnotations()) { if (annotationToNameExtractor.containsKey(annotation.annotationType())) { name = annotationToNameExtractor.get(annotation.annotationType()).apply(annotation); break; } } return name; } }
@VisibleForTesting <T> String translateName(Invokable<T, T> c, int index) { String name = null; if (markers.contains(ConstructorProperties.class) && c.getAnnotation(ConstructorProperties.class) != null) { String[] names = c.getAnnotation(ConstructorProperties.class).value(); if (names != null && names.length > index) { name = names[index]; } } for (Annotation annotation : c.getParameters().get(index).getAnnotations()) { if (annotationToNameExtractor.containsKey(annotation.annotationType())) { name = annotationToNameExtractor.get(annotation.annotationType()).apply(annotation); break; } } return name; } }
public static String getBucketName(HttpRequest req) { checkArgument(req instanceof GeneratedHttpRequest, "this should be a generated http request"); GeneratedHttpRequest request = GeneratedHttpRequest.class.cast(req); String bucketName = null; for (int i = 0; i < request.getInvocation().getInvokable().getParameters().size(); i++) { if (any(Arrays.asList(request.getInvocation().getInvokable().getParameters().get(i).getAnnotations()), ANNOTATIONTYPE_BUCKET)) { bucketName = (String) request.getInvocation().getArgs().get(i); break; } } return bucketName; }
public static String getBucketName(HttpRequest req) { checkArgument(req instanceof GeneratedHttpRequest, "this should be a generated http request"); GeneratedHttpRequest request = GeneratedHttpRequest.class.cast(req); String bucketName = null; for (int i = 0; i < request.getInvocation().getInvokable().getParameters().size(); i++) { if (any(Arrays.asList(request.getInvocation().getInvokable().getParameters().get(i).getAnnotations()), ANNOTATIONTYPE_BUCKET)) { bucketName = (String) request.getInvocation().getArgs().get(i); break; } } return bucketName; }
Dependency<ListenableFuture<?>> extractDependency(Errors methodErrors, Parameter parameter) { @Nullable Annotation bindingAnnotation = Annotations.findBindingAnnotation( methodErrors, parameter.getDeclaringInvokable(), parameter.getAnnotations()); return Dependency.get(futureKey( parameter.getType(), bindingAnnotation)); }
for (Annotation annotation : c.getParameters().get(index).getAnnotations()) { if (annotationToNameExtractor.containsKey(annotation.annotationType())) { name = annotationToNameExtractor.get(annotation.annotationType()).apply(annotation);
static boolean isNullable(Parameter param) { return isNullable(param.getAnnotatedType().getAnnotations()) || isNullable(param.getAnnotations()); }
for (Annotation annotation : c.getParameters().get(index).getAnnotations()) { if (annotationToNameExtractor.containsKey(annotation.annotationType())) { name = annotationToNameExtractor.get(annotation.annotationType()).apply(annotation);
for (Annotation annotation : c.getParameters().get(index).getAnnotations()) { if (annotationToNameExtractor.containsKey(annotation.annotationType())) { name = annotationToNameExtractor.get(annotation.annotationType()).apply(annotation);
public void testInstanceMethod_parameters() throws Exception { Invokable<?, ?> delegate = Prepender.method("prepend", Iterable.class); ImmutableList<Parameter> parameters = delegate.getParameters(); assertEquals(1, parameters.size()); assertEquals(new TypeToken<Iterable<String>>() {}, parameters.get(0).getType()); assertThat(parameters.get(0).getAnnotations()).isEmpty(); new EqualsTester().addEqualityGroup(parameters.get(0)).testEquals(); }