public static TypeElement asTypeElement(TypeMirror mirror) { return MoreElements.asType(asElement(mirror)); }
private void ensureNoHandlerMethodClashes() { List<String> handlerMethodNames = FluentIterable.from(proxyEventMethods) .transform(ProxyEventMethod::getHandlerMethodName) .toList(); Set<String> uniqueHandlerMethodNames = new HashSet<>(handlerMethodNames); if (handlerMethodNames.size() != uniqueHandlerMethodNames.size()) { // TODO: Probably not worth it, but with some gymnastic we could print exactly which methods. logger.error() .context(asElement(getPresenterMirror())) .log("Presenter contains multiple @ProxyEvents with handlers that have clashing method names."); throw new UnableToProcessException(); } }
@Override public Set<Element> process(SetMultimap<Class<? extends Annotation>, Element> elementsByAnnotation) { for (Map.Entry<Class<? extends Annotation>, Element> entry : elementsByAnnotation.entries()) { AnnotationMirror annotation = getAnnotationMirror(entry.getValue(), AndroidInjectorKeyRegistry.class).get(); for (TypeMirror mapKey : getAnnotationValue(annotation, "keys").accept(new Util.AllTypesVisitor(), null)) { if (daggerSupportedTypes.containsKey(mapKey)) { messager.printMessage(Diagnostic.Kind.ERROR, String.format("%s is automatically supported", mapKey)); } if (isAnnotationPresent(MoreTypes.asElement(mapKey), MapKey.class)) { TypeMirror mapKeyValue = mapKeyValue(mapKey, elements); annotationsAndTypes.put(mapKey, mapKeyValue); } else { messager.printMessage(Diagnostic.Kind.ERROR, String.format("%s is not a @MapKey", mapKey), entry.getValue()); } } } return ImmutableSet.of(); }
.map(a -> asElement(a.getAnnotationType()).getAnnotation(HttpMethod.class)) .filter(Objects::nonNull).map(HttpMethod::value).findFirst().orElse(GET)));
for (TypeMirror module : getAnnotationValue(annotation, "modules").accept(new AllTypesVisitor(), null)) { if (isAnnotationPresent(MoreTypes.asElement(module), Module.class)) { builder.modulesBuilder().add((ClassName) TypeName.get(module)); } else {