From 682f29be45644d0a158592ee59026950fa800a90 Mon Sep 17 00:00:00 2001 From: Gil Portenseigne Date: Fri, 4 Jan 2019 14:56:13 +0000 Subject: [PATCH] =?UTF-8?q?Improved:=20Refactoring=20=E2=80=98EntityCondit?= =?UTF-8?q?ion=E2=80=99=20-=20Rewrite=20EntityConditionList=20class=20(OFB?= =?UTF-8?q?IZ-10691)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This class is now final. The ‘getConditionListSize’ and ‘getConditionIterator’ methods has been inlined instead of overidding them from ‘EntityConditionListBase’. The Javadoc has been expanded. Thanks Mathieu for the contribution git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1850377 13f79535-47bb-0310-9956-ffa450edef68 --- .../entity/condition/EntityConditionList.java | 33 +++++++++++++++---- .../condition/EntityConditionListBase.java | 10 ------ 2 files changed, 26 insertions(+), 17 deletions(-) diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityConditionList.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityConditionList.java index e0cac36412..f15a50482c 100644 --- a/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityConditionList.java +++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityConditionList.java @@ -22,23 +22,42 @@ import java.util.Iterator; import java.util.List; /** - * Encapsulates a list of EntityConditions to be used as a single EntityCondition combined as specified - * + * A condition expression corresponding to an ordered collection of conditions + * that are joined by an operator. + *

+ * The main objective it to express the conjunction or disjunction of a set of + * conditions which in the case of conjunction corresponds to SQL expression + * of the form {@code foo=bar AND bar=baz AND ...}. */ @SuppressWarnings("serial") -public class EntityConditionList extends EntityConditionListBase { +public final class EntityConditionList extends EntityConditionListBase { + /** + * Constructs an entity condition list. + * + * @param conditionList the list of conditions + * @param operator the operator used to join the list of conditions + */ public EntityConditionList(List conditionList, EntityJoinOperator operator) { super(conditionList, operator); } - @Override + /** + * Provides the size of the internal list of condition expressions. + * + * @return the size of the internal list of condition expressions + */ public int getConditionListSize() { - return super.getConditionListSize(); + return conditionList.size(); } - @Override + /** + * Provides an iterator to iterate on the internal list of condition expressions. + * + * @return an iterator iterating on the internal list of condition expressions + */ + @SuppressWarnings("unchecked") public Iterator getConditionIterator() { - return super.getConditionIterator(); + return (Iterator)conditionList.iterator(); } @Override diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityConditionListBase.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityConditionListBase.java index 8cdbf9d7bc..c912cc6200 100644 --- a/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityConditionListBase.java +++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityConditionListBase.java @@ -18,7 +18,6 @@ *******************************************************************************/ package org.apache.ofbiz.entity.condition; -import java.util.Iterator; import java.util.List; import java.util.Map; @@ -52,15 +51,6 @@ public abstract class EntityConditionListBase impleme return this.conditionList.get(index); } - protected int getConditionListSize() { - return this.conditionList.size(); - } - - @SuppressWarnings("unchecked") - protected Iterator getConditionIterator() { - return (Iterator)this.conditionList.iterator(); - } - @Override public boolean isEmpty() { return operator.isEmpty(conditionList);