From c712db17091c639f1b8515edcced0cbb52c81a17 Mon Sep 17 00:00:00 2001 From: Isaac Manuel Raj Date: Fri, 12 Apr 2019 11:39:53 +0530 Subject: Code Enhancement (Sonar Fixes) Sonar Issues Fixes Issue-ID: SO-1490 Change-Id: Id171ab3833265715cd8976ad9f166a2e10c6561d Signed-off-by: Isaac Manuel Raj --- .../ceilometer/QueriableCeilometerCommand.java | 32 ++++++++-------------- 1 file changed, 11 insertions(+), 21 deletions(-) (limited to 'ceilometer-client/src/main/java/com/woorea') diff --git a/ceilometer-client/src/main/java/com/woorea/openstack/ceilometer/QueriableCeilometerCommand.java b/ceilometer-client/src/main/java/com/woorea/openstack/ceilometer/QueriableCeilometerCommand.java index 83eecd4..d8c0ead 100644 --- a/ceilometer-client/src/main/java/com/woorea/openstack/ceilometer/QueriableCeilometerCommand.java +++ b/ceilometer-client/src/main/java/com/woorea/openstack/ceilometer/QueriableCeilometerCommand.java @@ -23,52 +23,42 @@ import java.util.List; import com.woorea.openstack.base.client.OpenStackRequest; public abstract class QueriableCeilometerCommand extends OpenStackRequest { - + protected List fields = new ArrayList<>(); - + protected List ops = new ArrayList<>(); - + protected List values = new ArrayList<>(); - + private T filter(String field, String op, Serializable value) { fields.add(field); ops.add(op); values.add(value); return (T) this; } - + public T lt(String field, Serializable value) { return filter(field, "lt", value); } - + public T le(String field, Serializable value) { return filter(field, "le", value); } - + public T eq(String field, Serializable value) { return filter(field, "eq", value); } - + public T ne(String field, Serializable value) { return filter(field, "ne", value); } - + public T ge(String field, Serializable value) { return filter(field, "ge", value); } - + public T gt(String field, Serializable value) { return filter(field, "gt", value); } - /* - public WebTarget query(WebTarget target) { - if(fields.size() > 0) { - target = target.queryParam("q.field", fields.toArray()); - target = target.queryParam("q.op", ops.toArray()); - target = target.queryParam("q.value", values.toArray()); - } - return target; - } - */ -} +} \ No newline at end of file -- cgit 1.2.3-korg