Class DeprecatedPropertyScanner.PropertyMigrationRule
-
- All Implemented Interfaces:
public final class DeprecatedPropertyScanner.PropertyMigrationRuleData class representing a property migration rule with pattern matching.
Used for runtime extensibility when explicit mappings are insufficient. Most migrations use explicit mappings in exactPropertyMappings for safety.
PropertyMigrationRule( pattern = Pattern.compile("custom\\.company\\.(.+)"), replacement = "embabel.agent.custom.$1", description = "Custom company namespace migration" )
-
-
Field Summary
Fields Modifier and Type Field Description private final Patternpatternprivate final Stringreplacementprivate final Stringdescriptionprivate final Function1<String, Boolean>condition
-
Method Summary
Modifier and Type Method Description final PatterngetPattern()final StringgetReplacement()final StringgetDescription()final Function1<String, Boolean>getCondition()final StringtryApply(String property)Attempts to transform a deprecated property name into its recommended replacement. -
-
Method Detail
-
getPattern
final Pattern getPattern()
-
getReplacement
final String getReplacement()
-
getDescription
final String getDescription()
-
getCondition
final Function1<String, Boolean> getCondition()
-
tryApply
final String tryApply(String property)
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
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"- Parameters:
property- The deprecated property name string to transform- Returns:
The recommended replacement property name string if rule applies, null otherwise
-
-
-
-