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

guru.nidi.codeassert.model.ModelBuilder Maven / Gradle / Ivy

There is a newer version: 0.9.15
Show newest version
/*
 * Copyright © 2015 Stefan Niederhauser ([email protected])
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package guru.nidi.codeassert.model;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

import static java.util.Arrays.asList;

public class ModelBuilder {
    private final List files = new ArrayList<>();
    private final List ignorePackages = new ArrayList<>();
    private final List mergePackages = new ArrayList<>();

    ModelBuilder() {
    }

    public ModelBuilder and(File... files) {
        return and(asList(files));
    }

    public ModelBuilder and(List files) {
        this.files.addAll(files);
        return this;
    }

    public ModelBuilder ignoringPackages(String... packages) {
        return ignoringPackages(asList(packages));
    }

    public ModelBuilder ignoringPackages(List packages) {
        ignorePackages.addAll(packages);
        return this;
    }

    public ModelBuilder mergingPackages(String... packages) {
        return mergingPackages(asList(packages));
    }

    public ModelBuilder mergingPackages(List packages) {
        mergePackages.addAll(packages);
        return this;
    }

    public Model read() {
        return new Model(ignorePackages, mergePackages).read(files);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy