-
Notifications
You must be signed in to change notification settings - Fork 50
feat: add hook data support #1620
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
alexandraoberaigner
wants to merge
22
commits into
open-feature:main
Choose a base branch
from
open-feature-forking:feat/hook-data-support
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
269dfe4
feat: add hook data support
alexandraoberaigner 3b113c1
feat: gemini suggestions
alexandraoberaigner 5fb278b
feat: hook executor impl (WIP)
alexandraoberaigner ceedffd
Use shared hook context
guidobrei 2843298
Split HookData interface and implementation
guidobrei 235abba
Atopted tests
guidobrei e0935f3
Remove obsolete test
guidobrei dbfcab6
HookSupport improvements: rename back to old name, move code from sta…
alexandraoberaigner a3ed93e
PR suggestion: use concrete hooks
alexandraoberaigner 3ea9894
PR suggestions: DefaultHookData access modifier, no star imports
alexandraoberaigner 27f3e2a
feat: separate hook support data from logic, PR suggestions
alexandraoberaigner 4ab14bf
Update DefaultHookDataTest.java spotless
alexandraoberaigner 1d8f758
fix tests, spotless apply
alexandraoberaigner 8a9738f
exclude lombok generated functions from codecov
alexandraoberaigner b6cd0e2
replace init function with setters
alexandraoberaigner 1a7e5af
pr suggestion: replace Generated annotation with more descriptive Exc…
alexandraoberaigner 7fe0675
PR suggestion: make HookSupportData a real POJO
alexandraoberaigner 92b6dc4
gemini suggestions
alexandraoberaigner 0e897f2
PR suggestion: call hooks as early as possible
alexandraoberaigner 8b6aba9
PR suggestions: integration test hook data usage in client, set pair …
alexandraoberaigner 3417827
add hook data spec test
alexandraoberaigner db6cc86
Merge branch 'main' into feat/hook-data-support
alexandraoberaigner File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package dev.openfeature.sdk; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
/** | ||
* Default implementation of HookData. | ||
*/ | ||
public class DefaultHookData implements HookData { | ||
private Map<String, Object> data; | ||
|
||
@Override | ||
public void set(String key, Object value) { | ||
if (data == null) { | ||
data = new HashMap<>(); | ||
} | ||
data.put(key, value); | ||
} | ||
|
||
@Override | ||
public Object get(String key) { | ||
if (data == null) { | ||
return null; | ||
} | ||
return data.get(key); | ||
} | ||
|
||
@Override | ||
public <T> T get(String key, Class<T> type) { | ||
Object value = get(key); | ||
if (value == null) { | ||
return null; | ||
} | ||
if (!type.isInstance(value)) { | ||
throw new ClassCastException("Value for key '" + key + "' is not of type " + type.getName()); | ||
} | ||
return type.cast(value); | ||
} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.