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
|