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

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

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

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

import com.enonic.xp.repository.RepositoryId;

public class SystemDumpResult
    implements Iterable
{
    private final List repoDumpResults;

    private SystemDumpResult( final Builder builder )
    {
        repoDumpResults = builder.repoDumpResults;
    }

    public RepoDumpResult get( final RepositoryId repositoryId )
    {
        for ( final RepoDumpResult repoDumpResult : this.repoDumpResults )
        {
            if ( repoDumpResult.getRepositoryId().equals( repositoryId ) )
            {
                return repoDumpResult;
            }
        }

        return null;
    }

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

    public Stream stream()
    {
        return repoDumpResults.stream();
    }

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

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

        private Builder()
        {
        }

        public Builder add( final RepoDumpResult val )
        {
            repoDumpResults.add( val );
            return this;
        }

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


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy