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

com.enonic.xp.node.RoutableNodeVersionIds Maven / Gradle / Ivy

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

import java.util.Collection;
import java.util.LinkedHashSet;
import java.util.Set;

import com.google.common.collect.ImmutableSet;

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

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

    public static RoutableNodeVersionIds empty()
    {
        return new RoutableNodeVersionIds( ImmutableSet.of() );
    }

    public static RoutableNodeVersionIds from( final RoutableNodeVersionId... routableNodeVersionIds )
    {
        return new RoutableNodeVersionIds( ImmutableSet.copyOf( routableNodeVersionIds ) );
    }


    public static RoutableNodeVersionIds from( final Collection routableNodeVersionIds )
    {
        return new RoutableNodeVersionIds( ImmutableSet.copyOf( routableNodeVersionIds ) );
    }

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

    public static class Builder
    {
        final Set routableNodeVersionIds = new LinkedHashSet<>();

        public Builder add( final RoutableNodeVersionId routableNodeVersionId )
        {
            this.routableNodeVersionIds.add( routableNodeVersionId );
            return this;
        }

        public Builder addAll( final Collection routableNodeVersionIds )
        {
            this.routableNodeVersionIds.addAll( routableNodeVersionIds );
            return this;
        }

        public RoutableNodeVersionIds build()
        {
            return new RoutableNodeVersionIds( ImmutableSet.copyOf( this.routableNodeVersionIds ) );
        }

    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy