All Downloads are FREE. Search and download functionalities are using the official Maven repository.

poussecafe.doc.ClassesAnalyzer Maven / Gradle / Ivy

There is a newer version: 0.29.0
Show newest version
package poussecafe.doc;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.function.Consumer;
import javax.lang.model.element.TypeElement;
import poussecafe.doc.model.AnnotationsResolver;
import poussecafe.doc.model.DocletAccess;

public class ClassesAnalyzer {

    public static class Builder {

        private ClassesAnalyzer analyzer = new ClassesAnalyzer();

        public Builder classDocConsumer(Consumer classDocConsumer) {
            Objects.requireNonNull(classDocConsumer);
            analyzer.classDocConsumers.add(classDocConsumer);
            return this;
        }

        public ClassesAnalyzer build() {
            return analyzer;
        }
    }

    private ClassesAnalyzer() {

    }

    private List> classDocConsumers = new ArrayList<>();

    public void analyzeCode() {
        for (TypeElement classDoc : docletAccess.typeElements()) {
            if (!annotationsResolver.isIgnored(classDoc)) {
                processClassDoc(classDoc);
            }
        }
    }

    private DocletAccess docletAccess;

    private AnnotationsResolver annotationsResolver;

    private void processClassDoc(TypeElement classDoc) {
        for(Consumer consumer : classDocConsumers) {
            consumer.accept(classDoc);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy