pip_services3_commons.reflect.TypeMatcher module
pip_services3_commons.reflect.TypeMatcher
Type matcher implementation
- copyright
Conceptual Vision Consulting LLC 2018-2019, see AUTHORS for more details.
- license
MIT, see LICENSE for more details.
-
class
pip_services3_commons.reflect.TypeMatcher.
TypeMatcher
Bases:
object
Helper class matches args types for equality.
This class has symmetric implementation across all languages supported by Pip.Services toolkit and used to support dynamic data processing.
-
static
match_type
(expected_type: Any, actual_type: pip_services3_commons.convert.TypeCode.TypeCode, actual_value: Any = None) → bool Matches expected type to an actual type. The types can be specified as types, type names or
TypeCode
.- Parameters
expected_type – an expected type to match.
actual_type – an actual type to match.
actual_value – an optional args to match its type to the expected one.
- Returns
True if types are matching and False if they don’t.
-
static
match_type_by_name
(expected_type: str, actual_type: pip_services3_commons.convert.TypeCode.TypeCode, actual_value: Any = None) → bool Matches expected type to an actual type.
- Parameters
expected_type – an expected type name to match.
actual_type – an actual type to match defined by type code.
actual_value – an optional args to match its type to the expected one.
- Returns
true if types are matching and false if they don’t.
-
static
match_value_type
(expected_type: Any, actual_value: Any) → bool Matches expected type to a type of a args. The expected type can be specified by a type, type name or
TypeCode
.- Parameters
expected_type – an expected type to match.
actual_value – a args to match its type to the expected one.
- Returns
True if types are matching and False if they don’t.
-
static
match_value_type_by_name
(expected_type: str, actual_value: Any) → bool Matches expected type to a type of a args.
- Parameters
expected_type – an expected type name to match.
actual_value – a args to match its type to the expected one.
- Returns
True if types are matching and False if they don’t.
-
static