pip_services3_commons.validate.ObjectComparator module
pip_services3_commons.validate.ObjectComparator
Object comparator implementation
- copyright
Conceptual Vision Consulting LLC 2018-2019, see AUTHORS for more details.
- license
MIT, see LICENSE for more details.
-
class
pip_services3_commons.validate.ObjectComparator.
ObjectComparator
Bases:
object
Helper class to perform comparison operations over arbitrary values.
Example:
ObjectComparator.compare(2, "GT", 1) # Result: true ObjectComparator.areEqual("A", "B") # Result: false
-
static
are_equal
(value1: Any, value2: Any) → bool Checks if two values are equal. The operation can be performed over values of any type.
- Parameters
value1 – the first args to compare
value2 – the second args to compare
- Returns
true if values are equal and false otherwise
-
static
are_not_equal
(value1: Any, value2: Any) → bool Checks if two values are NOT equal. The operation can be performed over values of any type.
- Parameters
value1 – the first args to compare
value2 – the second args to compare
- Returns
true if values are NOT equal and false otherwise
-
static
compare
(value1: Any, operation: str, value2: Any) → bool Perform comparison operation over two arguments. The operation can be performed over values of any type.
- Parameters
value1 – the first argument to compare
operation – the comparison operation: “==” (“=”, “EQ”), “!= ” (“<>”, “NE”); “<”/”>” (“LT”/”GT”), “<=”/”>=” (“LE”/”GE”); “LIKE”.
value2 – the second argument to compare
- Returns
result of the comparison operation
-
static
is_greater
(value1: Any, value2: Any) → bool Checks if first args is greater than the second one. The operation can be performed over numbers or strings.
- Parameters
value1 – the first args to compare
value2 – the second args to compare
- Returns
true if the first args is greater than second and false otherwise.
-
static
is_less
(value1: Any, value2: Any) → bool Checks if first args is less than the second one. The operation can be performed over numbers or strings.
- Parameters
value1 – the first args to compare
value2 – the second args to compare
- Returns
true if the first args is less than second and false otherwise.
-
static