2121import com .basho .riak .client .core .query .Namespace ;
2222import com .basho .riak .client .core .query .functions .Function ;
2323
24+ import java .util .Objects ;
25+
2426/**
2527 * Command used to store (modify) the properties of a bucket in Riak.
2628 * <p>
2729 * <pre class="prettyprint">
2830 * {@code
2931 * Namespace ns = new Namespace("my_type", "my_bucket");
3032 * StoreBucketProperties sbp =
31- * new StoreBucketProperties.Builder(ns)
32- * .withAllowMulti(true)
33- * .build();
33+ * new StoreBucketProperties.Builder(ns)
34+ * .withAllowMulti(true)
35+ * .build();
3436 * client.execute(sbp);}</pre>
3537 * </p>
38+ *
3639 * @author Dave Rusek <drusek at basho dot com>
3740 * @since 2.0
3841 */
@@ -94,8 +97,7 @@ public final class StoreBucketProperties extends AsIsRiakCommand<Void, Namespace
9497 @ Override
9598 protected StoreBucketPropsOperation buildCoreOperation ()
9699 {
97- StoreBucketPropsOperation .Builder builder =
98- new StoreBucketPropsOperation .Builder (namespace );
100+ StoreBucketPropsOperation .Builder builder = new StoreBucketPropsOperation .Builder (namespace );
99101
100102 if (allowMulti != null )
101103 {
@@ -215,6 +217,76 @@ protected StoreBucketPropsOperation buildCoreOperation()
215217 return builder .build ();
216218 }
217219
220+ @ Override
221+ public boolean equals (Object other )
222+ {
223+ if (this == other )
224+ {
225+ return true ;
226+ }
227+
228+ if (!(other instanceof StoreBucketProperties ))
229+ {
230+ return false ;
231+ }
232+
233+ StoreBucketProperties otherStoreBucketProperties = (StoreBucketProperties ) other ;
234+
235+ return Objects .equals (namespace , otherStoreBucketProperties .namespace ) &&
236+ Objects .equals (allowMulti , otherStoreBucketProperties .allowMulti ) &&
237+ Objects .equals (backend , otherStoreBucketProperties .backend ) &&
238+ Objects .equals (basicQuorum , otherStoreBucketProperties .basicQuorum ) &&
239+ Objects .equals (bigVClock , otherStoreBucketProperties .bigVClock ) &&
240+ Objects .equals (chashkeyFunction , otherStoreBucketProperties .chashkeyFunction ) &&
241+ Objects .equals (lastWriteWins , otherStoreBucketProperties .lastWriteWins ) &&
242+ Objects .equals (linkWalkFunction , otherStoreBucketProperties .linkWalkFunction ) &&
243+ Objects .equals (rw , otherStoreBucketProperties .rw ) &&
244+ Objects .equals (dw , otherStoreBucketProperties .dw ) &&
245+ Objects .equals (w , otherStoreBucketProperties .w ) &&
246+ Objects .equals (r , otherStoreBucketProperties .r ) &&
247+ Objects .equals (pr , otherStoreBucketProperties .pr ) &&
248+ Objects .equals (pw , otherStoreBucketProperties .pw ) &&
249+ Objects .equals (notFoundOk , otherStoreBucketProperties .notFoundOk ) &&
250+ Objects .equals (preCommitHook , otherStoreBucketProperties .preCommitHook ) &&
251+ Objects .equals (postCommitHook , otherStoreBucketProperties .postCommitHook ) &&
252+ Objects .equals (oldVClock , otherStoreBucketProperties .oldVClock ) &&
253+ Objects .equals (youngVClock , otherStoreBucketProperties .youngVClock ) &&
254+ Objects .equals (smallVClock , otherStoreBucketProperties .smallVClock ) &&
255+ Objects .equals (nval , otherStoreBucketProperties .nval ) &&
256+ Objects .equals (legacySearch , otherStoreBucketProperties .legacySearch ) &&
257+ Objects .equals (searchIndex , otherStoreBucketProperties .searchIndex ) &&
258+ Objects .equals (hllPrecision , otherStoreBucketProperties .hllPrecision );
259+ }
260+
261+ @ Override
262+ public int hashCode ()
263+ {
264+ return Objects .hash (namespace ,
265+ allowMulti ,
266+ backend ,
267+ basicQuorum ,
268+ bigVClock ,
269+ chashkeyFunction ,
270+ lastWriteWins ,
271+ linkWalkFunction ,
272+ rw ,
273+ dw ,
274+ w ,
275+ r ,
276+ pr ,
277+ pw ,
278+ notFoundOk ,
279+ preCommitHook ,
280+ postCommitHook ,
281+ oldVClock ,
282+ youngVClock ,
283+ smallVClock ,
284+ nval ,
285+ legacySearch ,
286+ searchIndex ,
287+ hllPrecision );
288+ }
289+
218290 public static class Builder
219291 {
220292 private final Namespace namespace ;
@@ -282,7 +354,7 @@ public Builder withBackend(String backend)
282354
283355 /**
284356 * Set the basic_quorum value.
285- *
357+ * <p>
286358 * The parameter controls whether a read request should return early in
287359 * some fail cases. E.g. If a quorum of nodes has already returned
288360 * notfound/error, don't wait around for the rest.
@@ -301,7 +373,9 @@ public Builder withBasicQuorum(boolean use)
301373 *
302374 * @param bigVClock a long representing a epoch time value.
303375 * @return a reference to this object.
304- * @see <a href="http://docs.basho.com/riak/latest/theory/concepts/Vector-Clocks/#Vector-Clock-Pruning">Vector Clock Pruning</a>
376+ * @see
377+ * <a href="http://docs.basho.com/riak/latest/theory/concepts/Vector-Clocks/#Vector-Clock-Pruning">Vector
378+ * Clock Pruning</a>
305379 */
306380 public Builder withBigVClock (Long bigVClock )
307381 {
@@ -475,7 +549,9 @@ public Builder withPostcommitHook(Function hook)
475549 *
476550 * @param oldVClock an long representing a epoch time value.
477551 * @return a reference to this object.
478- * @see <a href="http://docs.basho.com/riak/latest/theory/concepts/Vector-Clocks/#Vector-Clock-Pruning">Vector Clock Pruning</a>
552+ * @see
553+ * <a href="http://docs.basho.com/riak/latest/theory/concepts/Vector-Clocks/#Vector-Clock-Pruning">Vector
554+ * Clock Pruning</a>
479555 */
480556 public Builder withOldVClock (Long oldVClock )
481557 {
@@ -488,7 +564,9 @@ public Builder withOldVClock(Long oldVClock)
488564 *
489565 * @param youngVClock a long representing a epoch time value.
490566 * @return a reference to this object.
491- * @see <a href="http://docs.basho.com/riak/latest/theory/concepts/Vector-Clocks/#Vector-Clock-Pruning">Vector Clock Pruning</a>
567+ * @see
568+ * <a href="http://docs.basho.com/riak/latest/theory/concepts/Vector-Clocks/#Vector-Clock-Pruning">Vector
569+ * Clock Pruning</a>
492570 */
493571 public Builder withYoungVClock (Long youngVClock )
494572 {
@@ -501,7 +579,9 @@ public Builder withYoungVClock(Long youngVClock)
501579 *
502580 * @param smallVClock a long representing a epoch time value.
503581 * @return a reference to this object.
504- * @see <a href="http://docs.basho.com/riak/latest/theory/concepts/Vector-Clocks/#Vector-Clock-Pruning">Vector Clock Pruning</a>
582+ * @see
583+ * <a href="http://docs.basho.com/riak/latest/theory/concepts/Vector-Clocks/#Vector-Clock-Pruning">Vector
584+ * Clock Pruning</a>
505585 */
506586 public Builder withSmallVClock (Long smallVClock )
507587 {
@@ -528,11 +608,11 @@ public Builder withNVal(int nVal)
528608 /**
529609 * Enable Legacy Riak Search. Setting this to true causes the search
530610 * pre-commit hook to be added.
531- *
611+ * <p>
532612 * <b>Note this is only for legacy Riak (< v2.0) Search support.</b>
533613 *
534614 * @param enable add/remove (true/false) the pre-commit hook for Legacy
535- * Riak Search.
615+ * Riak Search.
536616 * @return a reference to this object.
537617 */
538618 public Builder withLegacyRiakSearchEnabled (boolean enable )
0 commit comments