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

com.enonic.xp.project.ProjectGraphEntry Maven / Gradle / Ivy

There is a newer version: 7.14.4
Show newest version
package com.enonic.xp.project;

import com.google.common.base.Preconditions;

import com.enonic.xp.annotation.PublicApi;

@PublicApi
public final class ProjectGraphEntry
{
    private final ProjectName name;

    private final ProjectName parent;

    private ProjectGraphEntry( Builder builder )
    {
        this.name = builder.name;
        this.parent = builder.parent;
    }

    public static Builder create()
    {
        return new Builder();
    }

    public ProjectName getName()
    {
        return name;
    }

    public ProjectName getParent()
    {
        return parent;
    }

    @Override
    public String toString()
    {
        return "ProjectGraphEntry{" + "name=" + name + ", parent=" + parent + '}';
    }

    public static final class Builder
    {
        private ProjectName name;

        private ProjectName parent;

        private Builder()
        {
        }

        public Builder name( final ProjectName value )
        {
            this.name = value;
            return this;
        }

        public Builder parent( final ProjectName parent )
        {
            this.parent = parent;
            return this;
        }

        private void validate()
        {
            Preconditions.checkNotNull( name, "name cannot be null" );
        }


        public ProjectGraphEntry build()
        {
            validate();
            return new ProjectGraphEntry( this );
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy