You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[](https://www.repostatus.org/#active)
@@ -28,13 +28,13 @@
28
28
29
29
Standardizing feature flags unifies tools and vendors behind a common interface which avoids vendor lock-in at the code level. Additionally, it offers a framework for building extensions and integrations and allows providers to focus on their unique value proposition.
30
30
31
-
## 🔍 Requirements:
31
+
## 🔍 Requirements
32
32
33
33
- Java 8+ (compiler target is 1.8)
34
34
35
35
Note that this library is intended to be used in server-side contexts and has not been evaluated for use in mobile devices.
36
36
37
-
## 📦 Installation:
37
+
## 📦 Installation
38
38
39
39
### Maven
40
40
@@ -76,16 +76,14 @@ dependencies {
76
76
77
77
We publish SBOMs with all of our releases as of 0.3.0. You can find them in Maven Central alongside the artifacts.
78
78
79
-
## 🌟 Features:
79
+
## 🌟 Features
80
80
81
81
- support for various backend [providers](https://openfeature.dev/docs/reference/concepts/provider)
82
82
- easy integration and extension via [hooks](https://openfeature.dev/docs/reference/concepts/hooks)
Sometimes the value of a flag must take into account some dynamic criteria about the application or user, such as the user location, IP, email address, or the location of the server.
108
106
In OpenFeature, we refer to this as [`targeting`](https://openfeature.dev/specification/glossary#targeting).
@@ -127,9 +125,73 @@ EvaluationContext reqCtx = new ImmutableContext(targetingKey, attributes);
Events allow you to react to state changes in the provider or underlying flag management system, such as flag definition changes, provider readiness, or error conditions.
131
+
Initialization events (`PROVIDER_READY` on success, `PROVIDER_ERROR` on failure) are dispatched for every provider.
132
+
Some providers support additional events, such as `PROVIDER_CONFIGURATION_CHANGED`.
133
+
Please refer to the documentation of the provider you're using to see what events are supported.
See [here](https://openfeature.dev/ecosystem?instant_search%5BrefinementList%5D%5Btype%5D%5B0%5D=Hook&instant_search%5BrefinementList%5D%5Btechnology%5D%5B0%5D=Java) for a catalog of available hooks.
168
+
169
+
### Logging:
170
+
171
+
The Java SDK uses SLF4J. See the [SLF4J manual](https://slf4j.org/manual.html) for complete documentation.
172
+
173
+
### Named clients
174
+
175
+
Clients can be given a name.
176
+
A name is a logical identifier which can be used to associate clients with a particular provider.
177
+
If a name has no associated provider, clients with that name use the global provider.
To develop a provider, you need to create a new project and include the OpenFeature SDK as a dependency. This can be a new repository or included in [the existing contrib repository](https://github.com/open-feature/java-sdk-contrib) available under the OpenFeature organization. Finally, you’ll then need to write the provider itself. This can be accomplished by implementing the `FeatureProvider` interface exported by the OpenFeature SDK.
191
+
To develop a provider, you need to create a new project and include the OpenFeature SDK as a dependency.
192
+
This can be a new repository or included in [the existing contrib repository](https://github.com/open-feature/java-sdk-contrib) available under the OpenFeature organization.
193
+
Finally, you’ll then need to write the provider itself.
194
+
This can be accomplished by implementing the `FeatureProvider` interface exported by the OpenFeature SDK.
133
195
134
196
```java
135
197
publicclassMyProviderimplementsFeatureProvider {
@@ -167,31 +229,16 @@ public class MyProvider implements FeatureProvider {
167
229
168
230
See [here](https://openfeature.dev/ecosystem?instant_search%5BrefinementList%5D%5Btype%5D%5B0%5D=Provider&instant_search%5BrefinementList%5D%5Btechnology%5D%5B0%5D=Java) for a catalog of available providers.
169
231
170
-
### Hooks:
232
+
### Shutdown
171
233
172
-
A hook is a mechanism that allows for adding arbitrary behavior at well-defined points of the flag evaluation life-cycle. Use cases include validating the resolved flag value, modifying or adding data to the evaluation context, logging, telemetry, and tracking.
234
+
The OpenFeature API provides a close function to perform a cleanup of all registered providers.
235
+
This should only be called when your application is in the process of shutting down.
173
236
174
237
```java
175
-
publicclassMyHookimplementsHook {
176
-
/**
177
-
*
178
-
* @param ctx Information about the particular flag evaluation
179
-
* @param details Information about how the flag was resolved, including any resolved values.
180
-
* @param hints An immutable mapping of data for users to communicate to the hooks.
See [here](https://openfeature.dev/ecosystem?instant_search%5BrefinementList%5D%5Btype%5D%5B0%5D=Hook&instant_search%5BrefinementList%5D%5Btechnology%5D%5B0%5D=Java) for a catalog of available hooks.
190
-
191
-
### Logging:
192
-
193
-
The Java SDK uses SLF4J. See the [SLF4J manual](https://slf4j.org/manual.html) for complete documentation.
194
-
195
242
### Complete API documentation:
196
243
197
244
See [here](https://www.javadoc.io/doc/dev.openfeature/sdk/latest/index.html) for the complete API documentation.
0 commit comments