Skip to content
Permalink
Browse files

Improved: 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

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1850377 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
gilPts committed Jan 4, 2019
1 parent 31fdaae commit 682f29be45644d0a158592ee59026950fa800a90
@@ -22,23 +22,42 @@
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
@@ -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 T getCondition(int index) {
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);

0 comments on commit 682f29b

Please sign in to comment.
You can’t perform that action at this time.