usage: expose transition times as a typed accessor on UsageContext#40
Open
jutur wants to merge 1 commit into
Open
usage: expose transition times as a typed accessor on UsageContext#40jutur wants to merge 1 commit into
jutur wants to merge 1 commit into
Conversation
The invoice engine previously passed billing transition times to usage plugins via an untyped PluginProperty keyed USAGE_TRANSITIONS (a Map<Map.Entry<UUID,String>, Set<DateTime>>). Plugin authors had to know the internal property name and cast the raw Object value, making the contract fragile and undiscoverable. Add a default getUsageTransitions() method to UsageContext that returns the same map in a type-safe way. The default returns null so all existing UsageContext implementations remain binary-compatible. Kill Bill core will populate this in UsageInvoiceItemGenerator instead of (or alongside) the plugin property so plugins can migrate to the new accessor at their own pace. Fixes killbill/killbill#2257
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a default method to UsageContext:
default Map<Map.Entry<UUID, String>, Set> getUsageTransitions()
Previously, the invoice engine passed billing transition times to usage plugins via an untyped PluginProperty keyed USAGE_TRANSITIONS. Plugin authors had to know the internal property name and cast the raw Object value — a fragile, undiscoverable contract.
The new accessor exposes the same data in a type-safe way. The default returns null so all existing UsageContext implementations remain binary-compatible.
A companion PR to killbill/killbill populates this field in DefaultUsageContext.
Fixes killbill/killbill#2257