/[Apache-SVN]
ViewVC logotype

Revision 1850372


Jump to revision: Previous Next
Author: pgil
Date: Fri Jan 4 14:50:13 2019 UTC (5 years, 3 months ago)
Changed paths: 12
Log Message:
Improved: Refactoring ‘EntityCondition’ - Remove EntityConditionBase class
(OFBIZ-10691)

This is removing an abuse of inheritance for code reuse which was·
breaking Liskov substitution principle.  This has been achieved with
the following changes:

* The ‘Serializable’ interface which was implemented by
‘EntityConditionBase’ is now implemented directly by the·
‘EntityCondition’, ‘EntityConditionValue’, and ‘EntityOperator’
classes.

* ‘emptyList’ and ‘_emptyMap’ useless static members has been removed
and ‘emptyAliases’ has been move down to the ‘EntityConditionValue’
subclass.

* The ‘castBoolean’ method has been removed due to the automatic
boxing/unboxing of boolean and Boolean values which make it useless.

* ‘equals’ and ‘hashCode’ pseudo abstract methods (meaning methods
        throwing an unsupported operation exception) has been moved down to
the ‘EntityCondition’ and ‘EntityConditionValue’ sub classes.
‘Objects#equals’ and ‘Objects#hashCode’ standard methods has been
used in the EntityCondition class hierarchy instead.

* The ‘getColName’ methods has been moved down to the·
‘EntityConditionValue’ class which is the unique class using those
methods.

* The remaining static methods ‘getField’ and ‘addValue’ has been
moved to a new ‘EntityConditionUtils’ class.  The unused override of
‘addValue’ has been removed which allowed us to make this method
static.

Thanks Mathieu for the contribution

Changed paths

Path Details
Directoryofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityComparisonOperator.java modified , text changed
Directoryofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityCondition.java modified , text changed
Directoryofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityConditionBase.java deleted
Directoryofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityConditionUtils.java added
Directoryofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityConditionValue.java modified , text changed
Directoryofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityDateFilterCondition.java modified , text changed
Directoryofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityExpr.java modified , text changed
Directoryofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityFieldValue.java modified , text changed
Directoryofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityFunction.java modified , text changed
Directoryofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityJoinOperator.java modified , text changed
Directoryofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityOperator.java modified , text changed
Directoryofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityWhereString.java modified , text changed

infrastructure at apache.org
ViewVC Help
Powered by ViewVC 1.1.26