ConvertiblePair constructor

ConvertiblePair(
  1. Class sourceType,
  2. Class targetType
)

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");
}

Creates a new ConvertiblePair with the given sourceType and targetType.

This constructor is typically used when registering or querying converters.

Implementation

ConvertiblePair(this.sourceType, this.targetType);