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

com.enonic.xp.query.aggregation.AggregationQueries Maven / Gradle / Ivy

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

import java.util.Collection;

import com.google.common.collect.ImmutableSet;

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

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

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

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

    public static AggregationQueries fromCollection( final Collection aggregationQueries )
    {
        return new AggregationQueries( ImmutableSet.copyOf( aggregationQueries ) );
    }

    public static final class Builder
    {
        private final ImmutableSet.Builder aggregationQueries = ImmutableSet.builder();

        public Builder add( final AggregationQuery aggregationQuery )
        {
            this.aggregationQueries.add( aggregationQuery );
            return this;
        }

        public AggregationQueries build()
        {
            return new AggregationQueries( this.aggregationQueries.build() );
        }
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy