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

org.gradle.plugins.ide.internal.tooling.idea.DefaultIdeaContentRoot Maven / Gradle / Ivy

There is a newer version: 8.11.1
Show newest version
/*
 * Copyright 2011 the original author or authors.
 *
 * 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 org.gradle.plugins.ide.internal.tooling.idea;

import java.io.File;
import java.io.Serializable;
import java.util.LinkedHashSet;
import java.util.Set;

public class DefaultIdeaContentRoot implements Serializable {

    File rootDirectory;
    Set sourceDirectories = new LinkedHashSet();
    Set testDirectories = new LinkedHashSet();
    Set excludeDirectories = new LinkedHashSet();

    public File getRootDirectory() {
        return rootDirectory;
    }

    public DefaultIdeaContentRoot setRootDirectory(File rootDirectory) {
        this.rootDirectory = rootDirectory;
        return this;
    }

    public Set getSourceDirectories() {
        return sourceDirectories;
    }

    public DefaultIdeaContentRoot setSourceDirectories(Set sourceDirectories) {
        this.sourceDirectories = sourceDirectories;
        return this;
    }

    public Set getGeneratedSourceDirectories() {
        return generated(sourceDirectories);
    }

    private Set generated(Set directories) {
        Set generated = new LinkedHashSet();
        for (DefaultIdeaSourceDirectory sourceDirectory : directories) {
            if (sourceDirectory.isGenerated()) {
                generated.add(sourceDirectory);
            }
        }
        return generated;
    }

    public Set getTestDirectories() {
        return testDirectories;
    }

    public DefaultIdeaContentRoot setTestDirectories(Set testDirectories) {
        this.testDirectories = testDirectories;
        return this;
    }

    public Set getGeneratedTestDirectories() {
        return generated(testDirectories);
    }

    public Set getExcludeDirectories() {
        return excludeDirectories;
    }

    public DefaultIdeaContentRoot setExcludeDirectories(Set excludeDirectories) {
        this.excludeDirectories = excludeDirectories;
        return this;
    }

    @Override
    public String toString() {
        return "IdeaContentRoot{"
                + "rootDirectory=" + rootDirectory
                + ", sourceDirectories count=" + sourceDirectories.size()
                + ", testDirectories count=" + testDirectories.size()
                + ", excludeDirectories count=" + excludeDirectories.size()
                + '}';
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy