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

com.enonic.xp.issue.PublishRequestItems Maven / Gradle / Ivy

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

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

import com.google.common.collect.ImmutableSet;

import com.enonic.xp.annotation.PublicApi;
import com.enonic.xp.support.AbstractImmutableEntitySet;

@PublicApi
public final class PublishRequestItems
    extends AbstractImmutableEntitySet
    implements Iterable
{
    private PublishRequestItems( final ImmutableSet set )
    {
        super( set );
    }

    public static PublishRequestItems empty()
    {
        final ImmutableSet set = ImmutableSet.of();
        return new PublishRequestItems( set );
    }

    public static PublishRequestItems from( final PublishRequestItem... items )
    {
        return new PublishRequestItems( ImmutableSet.copyOf( items ) );
    }

    public static PublishRequestItems from( final Iterable items )
    {
        return new PublishRequestItems( ImmutableSet.copyOf( items ) );
    }

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

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

        public Builder add( final PublishRequestItem item )
        {
            this.items.add( item );
            return this;
        }

        public Builder addAll( final PublishRequestItems items )
        {
            this.items.addAll( items.getSet() );
            return this;
        }


        public PublishRequestItems build()
        {
            return PublishRequestItems.from( items );
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy