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

com.enonic.xp.dump.RepoLoadResult Maven / Gradle / Ivy

The newest version!
package com.enonic.xp.dump;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import com.enonic.xp.repository.RepositoryId;

public class RepoLoadResult
    implements Iterable
{
    private final List branchResults;

    private final VersionsLoadResult versionsLoadResult;

    private final CommitsLoadResult commitsLoadResult;

    private final RepositoryId repositoryId;

    private RepoLoadResult( final Builder builder )
    {
        this.branchResults = builder.branchResults;
        this.repositoryId = builder.repositoryId;
        this.versionsLoadResult = builder.versionsLoadResult;
        this.commitsLoadResult = builder.commitsLoadResult;
    }

    @Override
    public Iterator iterator()
    {
        return this.branchResults.iterator();
    }

    @SuppressWarnings("unused")
    public List getBranchResults()
    {
        return branchResults;
    }

    @SuppressWarnings("unused")
    public RepositoryId getRepositoryId()
    {
        return repositoryId;
    }

    public VersionsLoadResult getVersionsLoadResult()
    {
        return versionsLoadResult;
    }

    public CommitsLoadResult getCommitsLoadResult()
    {
        return commitsLoadResult;
    }

    public static Builder create( final RepositoryId repositoryId )
    {
        return new Builder( repositoryId );
    }

    public static final class Builder
    {
        private final List branchResults = new ArrayList<>();

        private final RepositoryId repositoryId;

        private VersionsLoadResult versionsLoadResult = VersionsLoadResult.create().build();

        private CommitsLoadResult commitsLoadResult;


        private Builder( final RepositoryId repositoryId )
        {
            this.repositoryId = repositoryId;
        }

        public Builder add( final BranchLoadResult val )
        {
            branchResults.add( val );
            return this;
        }

        public Builder versions( final VersionsLoadResult val )
        {
            versionsLoadResult = val;
            return this;
        }

        public Builder commits( final CommitsLoadResult val )
        {
            commitsLoadResult = val;
            return this;
        }

        public RepoLoadResult build()
        {
            return new RepoLoadResult( this );
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy