Source:
ImmutableSet<FactoryMethodDescriptor> generateDescriptor(Element element) { final AutoFactoryDeclaration declaration = AutoFactoryDeclaration.fromAnnotationMirror( elements, Mirrors.getAnnotationMirror(element, AutoFactory.class).get()); return element.accept(new ElementKindVisitor6<ImmutableSet<FactoryMethodDescriptor>, Void>() { @Override protected ImmutableSet<FactoryMethodDescriptor> defaultAction(Element e, Void p) { return ImmutableSet.of(); } @Override public ImmutableSet<FactoryMethodDescriptor> visitTypeAsClass(TypeElement type, Void p) { if (type.getModifiers().contains(ABSTRACT)) { } else { ImmutableSet<ExecutableElement> constructors = Elements2.getConstructors(type); if (constructors.isEmpty()) { return ImmutableSet.of(new FactoryMethodDescriptor.Builder(declaration) .factoryName(declaration.getFactoryName( elements.getPackageOf(type).getQualifiedName(), type.getSimpleName())) .name("create") .returnType(type.getQualifiedName().toString()) .passedParameters(ImmutableSet.<Parameter>of()) .creationParameters(ImmutableSet.<Parameter>of()) .providedParameters(ImmutableSet.<Parameter>of()) .build()); } else { return FluentIterable.from(constructors) .transform(new Function<ExecutableElement, FactoryMethodDescriptor>() { @Override public FactoryMethodDescriptor apply(ExecutableElement constructor) { return generateDescriptorForConstructor(declaration, constructor); } }) .toSet(); } } return ImmutableSet.of(); } @Override public ImmutableSet<FactoryMethodDescriptor> visitTypeAsInterface(TypeElement e, Void p) { return super.visitTypeAsInterface(e, p); } @Override public ImmutableSet<FactoryMethodDescriptor> visitExecutableAsConstructor(ExecutableElement e, Void p) { return super.visitExecutableAsConstructor(e, p); } }, null); }

Target:
ImmutableSet<FactoryMethodDescriptor> generateDescriptor(Element element) { final AutoFactoryDeclaration declaration = AutoFactoryDeclaration.fromAnnotationMirror( elements, Mirrors.getAnnotationMirror(element, AutoFactory.class).get()); return element.accept(new ElementKindVisitor6<ImmutableSet<FactoryMethodDescriptor>, Void>() { @Override protected ImmutableSet<FactoryMethodDescriptor> defaultAction(Element e, Void p) { return ImmutableSet.of(); } @Override public ImmutableSet<FactoryMethodDescriptor> visitTypeAsClass(TypeElement type, Void p) { if (type.getModifiers().contains(ABSTRACT)) { } else { ImmutableSet<ExecutableElement> constructors = Elements2.getConstructors(type); if (constructors.isEmpty()) { return generateDescriptorForDefaultConstructor(declaration, type); } else { return FluentIterable.from(constructors) .transform(new Function<ExecutableElement, FactoryMethodDescriptor>() { @Override public FactoryMethodDescriptor apply(ExecutableElement constructor) { return generateDescriptorForConstructor(declaration, constructor); } }) .toSet(); } } return ImmutableSet.of(); } @Override public ImmutableSet<FactoryMethodDescriptor> visitTypeAsInterface(TypeElement e, Void p) { return super.visitTypeAsInterface(e, p); } @Override public ImmutableSet<FactoryMethodDescriptor> visitExecutableAsConstructor(ExecutableElement e, Void p) { return super.visitExecutableAsConstructor(e, p); } }, null); }