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 f15a50482c1..ea201571370 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 @@ -47,7 +47,7 @@ public EntityConditionList(List conditionList, EntityJoinOperator o * @return the size of the internal list of condition expressions */ public int getConditionListSize() { - return conditionList.size(); + return conditions.size(); } /** @@ -57,7 +57,7 @@ public int getConditionListSize() { */ @SuppressWarnings("unchecked") public Iterator getConditionIterator() { - return (Iterator)conditionList.iterator(); + return (Iterator)conditions.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 c912cc6200e..54bdf9cbe15 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 @@ -28,54 +28,71 @@ import org.apache.ofbiz.entity.model.ModelEntity; /** - * Encapsulates a list of EntityConditions to be used as a single EntityCondition combined as specified - * + * Represents a combination of multiple condition expressions. */ @SuppressWarnings("serial") -public abstract class EntityConditionListBase implements EntityCondition { +abstract class EntityConditionListBase implements EntityCondition { public static final String module = EntityConditionListBase.class.getName(); - - protected final List conditionList; + /** The list of condition expressions to combine. */ + protected final List conditions; + /** The infix operator used to combine every elements in the list of conditions. */ protected final EntityJoinOperator operator; - protected EntityConditionListBase(List conditionList, EntityJoinOperator operator) { - this.conditionList = conditionList; + /** + * Constructs a combination of multiple condition expressions. + * + * @param conditions the list of condition expressions to combine + * @param operator the infix operator used to combine every elements in the list of conditions + */ + protected EntityConditionListBase(List conditions, EntityJoinOperator operator) { + this.conditions = conditions; this.operator = operator; } + /** + * Gets the infix operator used to combine every elements in the list of conditions. + * + * @return the infix operator used to combine every elements in the list of conditions. + */ public EntityJoinOperator getOperator() { - return this.operator; + return operator; } + /** + * Gets the condition expression stored at a particular of the internal list of conditions. + * + * @param index the index of the condition expression to find + * @return the corresponding condition expression + */ public T getCondition(int index) { - return this.conditionList.get(index); + return conditions.get(index); } @Override public boolean isEmpty() { - return operator.isEmpty(conditionList); + return operator.isEmpty(conditions); } @Override public String makeWhereString(ModelEntity modelEntity, List entityConditionParams, Datasource datasourceInfo) { StringBuilder sql = new StringBuilder(); - operator.addSqlValue(sql, modelEntity, entityConditionParams, conditionList, datasourceInfo); + operator.addSqlValue(sql, modelEntity, entityConditionParams, conditions, datasourceInfo); return sql.toString(); } @Override public void checkCondition(ModelEntity modelEntity) throws GenericModelException { - operator.validateSql(modelEntity, conditionList); + operator.validateSql(modelEntity, conditions); } @Override public boolean mapMatches(Delegator delegator, Map map) { - return operator.mapMatches(delegator, map, conditionList); + return operator.mapMatches(delegator, map, conditions); } @Override public EntityCondition freeze() { - return operator.freeze(conditionList); + return operator.freeze(conditions); } @Override @@ -85,12 +102,12 @@ public boolean equals(Object obj) { } EntityConditionListBase other = UtilGenerics.cast(obj); - return conditionList.equals(other.conditionList) && operator.equals(other.operator); + return conditions.equals(other.conditions) && operator.equals(other.operator); } @Override public int hashCode() { - return conditionList.hashCode() + operator.hashCode(); + return conditions.hashCode() + operator.hashCode(); } @Override