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

com.basho.riak.client.api.commands.mapreduce.BucketMapReduce Maven / Gradle / Ivy

There is a newer version: 2.1.1
Show newest version
package com.basho.riak.client.api.commands.mapreduce;

import com.basho.riak.client.core.query.Namespace;
import com.basho.riak.client.api.commands.mapreduce.filters.KeyFilter;

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

public class BucketMapReduce extends MapReduce
{

	protected BucketMapReduce(BucketInput input, Builder builder)
	{
		super(input, builder);
	}

	public static class Builder extends MapReduce.Builder
	{

		private Namespace namespace;
		private final List filters = new ArrayList();

		@Override
		protected Builder self()
		{
			return this;
		}

		public Builder withNamespace(Namespace namespace)
		{
			this.namespace = namespace;
			return this;
		}

		public Builder withKeyFilter(KeyFilter filter)
		{
            filters.add(filter);
			return this;
		}
        
		public BucketMapReduce build()
		{
			if (namespace == null)
			{
				throw new IllegalStateException("A Namespace must be specified");
			}

			return new BucketMapReduce(new BucketInput(namespace, filters), this);
		}
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy