try Apply
Attempts to transform a deprecated property name into its recommended replacement.
IMPORTANT: This method performs string transformation only - it does NOT modify any files or source code. It's used purely for generating migration recommendations that will be shown in warnings.
The transformation follows these steps:
Check optional condition (if present) - return null if condition fails
Apply regex pattern matching against the property name string
If pattern matches, perform string substitution using replacement template
Return the transformed property name string or null if no match
Example Usage
val rule = PropertyMigrationRule(
pattern = Pattern.compile("embabel\\.([^.]+)\\.max-attempts"),
replacement = "embabel.agent.platform.models.$1.max-attempts"
)
val result = rule.tryApply("embabel.anthropic.max-attempts")
// Returns: "embabel.agent.platform.models.anthropic.max-attempts"
Content copied to clipboard
Return
The recommended replacement property name string if rule applies, null otherwise
Parameters
property
The deprecated property name string to transform