ConvertiblePair class final
Represents a pair of source and target types for type conversion.
This class is used in conversion frameworks to define mappings between one type and another. It forms the basis for determining whether a specific converter can handle a particular type conversion.
π§ Example:
final pair = ConvertiblePair(Class<String>(), Class<int>());
print(pair); // java.lang.String -> int
if (pair.getSourceType() == Class<String>()) {
print("This pair converts from String");
}
Constructors
- ConvertiblePair(Class sourceType, Class targetType)
- Represents a pair of source and target types for type conversion.
Properties
- hashCode β int
-
The hash code for this object.
no setteroverride
- runtimeType β Type
-
A representation of the runtime type of the object.
no setterinherited
- sourceType β Class
-
The source type of the conversion.
final
- targetType β Class
-
The target type of the conversion.
final
Methods
-
getSourceType(
) β Class - Returns the source type of this pair.
-
getTargetType(
) β Class - Returns the target type of this pair.
-
noSuchMethod(
Invocation invocation) β dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
reverse(
) β ConvertiblePair - Creates a new ConvertiblePair with reversed source and target types.
-
toString(
) β String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) β bool -
The equality operator.
override