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

de.aaschmid.gradle.plugins.cpd.internal.CpdReportsImpl Maven / Gradle / Ivy

package de.aaschmid.gradle.plugins.cpd.internal;

import javax.inject.Inject;

import de.aaschmid.gradle.plugins.cpd.Cpd;
import de.aaschmid.gradle.plugins.cpd.CpdCsvFileReport;
import de.aaschmid.gradle.plugins.cpd.CpdReports;
import de.aaschmid.gradle.plugins.cpd.CpdTextFileReport;
import de.aaschmid.gradle.plugins.cpd.CpdXmlFileReport;
import org.gradle.api.Action;
import org.gradle.api.model.ObjectFactory;
import org.gradle.api.reporting.SingleFileReport;

public class CpdReportsImpl extends Reports implements CpdReports {

    @Inject
    public CpdReportsImpl(Cpd task, ObjectFactory objects) {
        super(task.getProject(), SingleFileReport.class);

        final CpdCsvFileReportImpl csv = objects.newInstance(CpdCsvFileReportImpl.class, "csv", task);
        final CpdTextFileReportImpl text = objects.newInstance(CpdTextFileReportImpl.class, "text", task);
        final CpdReportInternal vs = objects.newInstance(CpdReportInternal.class, "vs", task);
        final CpdXmlFileReportImpl xml = objects.newInstance(CpdXmlFileReportImpl.class, "xml", task);

        addReport(csv);
        addReport(text);
        addReport(vs);
        addReport(xml);
    }

    @Override
    public CpdCsvFileReport getCsv() {
        return (CpdCsvFileReport) getByName("csv");
    }

    @Override
    public CpdTextFileReport getText() {
        return (CpdTextFileReport) getByName("text");
    }

    @Override
    public SingleFileReport getVs() {
        return getByName("vs");
    }

    @Override
    public CpdXmlFileReport getXml() {
        return (CpdXmlFileReport) getByName("xml");
    }

    @Override
    public void csv(Action action) {
        action.execute(getCsv());
    }

    @Override
    public void text(Action action) {
        action.execute(getText());
    }

    @Override
    public void vs(Action action) {
        action.execute(getVs());
    }

    @Override
    public void xml(Action action) {
        action.execute(getXml());
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy