svn commit: r1850377 - in /ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/condition: EntityConditionList.java EntityConditionListBase.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1850377 - in /ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/condition: EntityConditionList.java EntityConditionListBase.java

pgil
Author: pgil
Date: Fri Jan  4 14:56:13 2019
New Revision: 1850377

URL: http://svn.apache.org/viewvc?rev=1850377&view=rev
Log:
Refactoring ‘EntityCondition’ - Rewrite EntityConditionList class
(OFBIZ-10691)

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

Modified:
    ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityConditionList.java
    ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityConditionListBase.java

Modified: ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityConditionList.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityConditionList.java?rev=1850377&r1=1850376&r2=1850377&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityConditionList.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityConditionList.java Fri Jan  4 14:56:13 2019
@@ -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.
+ * <p>
+ * 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<T extends EntityCondition> extends EntityConditionListBase<T> {
+public final class EntityConditionList<T extends EntityCondition> extends EntityConditionListBase<T> {
+    /**
+     * 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<? extends T> 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<T> getConditionIterator() {
-        return super.getConditionIterator();
+        return (Iterator<T>)conditionList.iterator();
     }
 
     @Override

Modified: ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityConditionListBase.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityConditionListBase.java?rev=1850377&r1=1850376&r2=1850377&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityConditionListBase.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityConditionListBase.java Fri Jan  4 14:56:13 2019
@@ -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 EntityConditionLis
         return this.conditionList.get(index);
     }
 
-    protected int getConditionListSize() {
-        return this.conditionList.size();
-    }
-
-    @SuppressWarnings("unchecked")
-    protected Iterator<T> getConditionIterator() {
-        return (Iterator<T>)this.conditionList.iterator();
-    }
-
     @Override
     public boolean isEmpty() {
         return operator.isEmpty(conditionList);