Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Updated DynamicComposite to override super's addComponent methods #597

Merged
merged 1 commit into from

2 participants

@thrykol
Collaborator

In order to use chaining when adding components to a DynamicComposite, the resulting object currently has to be cast as a DynamicComposite as the return type for addComponent is AbstractComposite.

I've updated DynamicComposite to override each addComponent method in AbstractComposite so that the DynamicComposite object can be returned.

@zznate
Collaborator

Nice. Thanks!

@zznate zznate merged commit 3e25279 into master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 14, 2013
This page is out of date. Refresh to see the latest.
View
42 core/src/main/java/me/prettyprint/hector/api/beans/DynamicComposite.java
@@ -2,6 +2,7 @@
import java.nio.ByteBuffer;
import java.util.List;
+import me.prettyprint.hector.api.Serializer;
public class DynamicComposite extends AbstractComposite {
@@ -36,4 +37,45 @@ public static ByteBuffer toByteBuffer(List<?> l) {
DynamicComposite composite = new DynamicComposite(l);
return composite.serialize();
}
+
+ @Override
+ public <T> DynamicComposite addComponent(int index, T element, ComponentEquality equality) {
+ super.addComponent(index, element, equality);
+
+ return this;
+ }
+
+ @Override
+ public <T> DynamicComposite addComponent(T value, Serializer<T> s) {
+ super.addComponent(value, s);
+
+ return this;
+ }
+
+ @Override
+ public <T> DynamicComposite addComponent(T value, Serializer<T> s,
+ String comparator) {
+ super.addComponent(value, s, comparator);
+
+ return this;
+
+ }
+
+ @Override
+ public <T> DynamicComposite addComponent(T value, Serializer<T> s,
+ String comparator, ComponentEquality equality) {
+ super.addComponent(value, s, comparator, equality);
+
+ return this;
+
+ }
+
+ @Override
+ public <T> DynamicComposite addComponent(int index, T value,
+ Serializer<T> s, String comparator, ComponentEquality equality) {
+ super.addComponent(index, value, s, comparator, equality);
+
+ return this;
+
+ }
}
Something went wrong with that request. Please try again.