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

org.coderu.plugins.maven.utils.CoderuConfiguration Maven / Gradle / Ivy

package org.coderu.plugins.maven.utils;

import java.util.Collection;

import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.coderu.core.api.Aliases;
import org.coderu.core.api.CompileUnit;
import org.coderu.core.api.DependencyOnSameLevelAllowed;
import org.coderu.core.api.Depth;
import org.coderu.core.api.Packagge;

public final class CoderuConfiguration {

    public Collection getCompileUnit() {
        return compileUnit;
    }

    public Collection getComponents() {
        return components;
    }

    public Collection getExcluded() {
        return excluded;
    }

    public Depth getCalculatedDepth() {
        return calculatedDepth;
    }

    public DependencyOnSameLevelAllowed getDependencyOnSameLevelAllowed() {
        return dependencyOnSameLevelAllowed;
    }

    public Aliases getAliases() {
		return aliases;
	}
    
    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE)
                .append(compileUnit)
                .append(components)
                .append(excluded)
                .append(dependencyOnSameLevelAllowed)
                .append(calculatedDepth)
                .append(dependencyOnSameLevelAllowed)
                .append(aliases)
                .toString();
    }

    @Override
    public int hashCode() {
        return new HashCodeBuilder(3, 21).append(compileUnit)
                .append(components)
                .append(excluded)
                .append(calculatedDepth)
                .append(dependencyOnSameLevelAllowed)
                .append(aliases)
                .toHashCode();
    }

    @Override
    public boolean equals(final Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;

        final CoderuConfiguration other = (CoderuConfiguration) obj;

        return new EqualsBuilder().append(compileUnit, other.compileUnit)
                .append(components, other.components)
                .append(excluded, other.excluded)
                .append(calculatedDepth, other.calculatedDepth)
                .append(dependencyOnSameLevelAllowed, other.dependencyOnSameLevelAllowed)
                .append(aliases, other.aliases)
                .isEquals();
    }

    public CoderuConfiguration(final Collection compileUnit,
            final Collection components,
            final Collection excluded, final Depth calculatedDepth,
            final DependencyOnSameLevelAllowed dependencyOnSameLevelAllowed,
            final Aliases aliases) {

        this.compileUnit = CompileUnit.ORDERING.immutableSortedCopy(compileUnit);
        this.components = Packagge.ORDERING.immutableSortedCopy(components);
        this.excluded = Packagge.ORDERING.immutableSortedCopy(excluded);
        this.calculatedDepth = calculatedDepth;
        this.dependencyOnSameLevelAllowed = dependencyOnSameLevelAllowed;
        this.aliases = aliases;
    }

    final Collection compileUnit;
    final Collection components;
    final Collection excluded;
    final Depth calculatedDepth;
    final DependencyOnSameLevelAllowed dependencyOnSameLevelAllowed;
    final Aliases aliases;
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy