Java implementation of the OpenFeature SDK
Go to file
Justin Abrahms 54d02a4357
Installation instructions.
2022-06-14 13:11:43 -07:00
.github/workflows Add coverage validation 2022-06-14 11:34:20 -07:00
gradle/wrapper Skeleton implementation of the java sdk 2022-04-20 21:12:09 -07:00
lib Generate coverage xml 2022-06-14 11:37:01 -07:00
.gitattributes Skeleton implementation of the java sdk 2022-04-20 21:12:09 -07:00
.gitignore Ignore any specification files (used for linting) 2022-06-12 20:44:55 -07:00
LICENSE Add Apache2.0 license 2022-04-29 15:21:59 -04:00
README.md Installation instructions. 2022-06-14 13:11:43 -07:00
gradlew Skeleton implementation of the java sdk 2022-04-20 21:12:09 -07:00
gradlew.bat Skeleton implementation of the java sdk 2022-04-20 21:12:09 -07:00
settings.gradle Skeleton implementation of the java sdk 2022-04-20 21:12:09 -07:00
spec_finder.py Support for spec validation 2022-06-09 15:11:19 -05:00

README.md

OpenFeature SDK for Java

Project Status: WIP – Initial development is in progress, but there has not yet been a stable, usable release suitable for the public. Known Vulnerabilities on-merge codecov

This is the Java implementation of Open Feature. It is intended to be used in server-side contexts and has not been evaluated for use in mobile devices.

Usage

There are a variety flag types that we offer, but Boolean provides the simplest introduction. We can use this SDK to

class MyClass {
    // ...
    public void myFunction() {
        if (client.getBooleanValue("redesign_enabled", false)) {
            return render_redesign();
        }
        return render_normal();
    }
    // ...
}

Requirements

  • Java 11+

Installation

Add it to your build

Maven:

<dependency>
    <groupId>dev.openfeature</groupId>
    <artifactId>javasdk</artifactId>
    <version>0.0.1-SNAPSHOT</version>
</dependency>

Gradle:

dependencies {
    implementation 'dev.openfeature:javasdk:0.0.1-SNAPSHOT'
}

Configure it

To configure it, you'll need to add a provider to the global singleton OpenFeatureAPI. From there, you can generate a Client which is usable by your code. While you'll likely want a provider for your specific backend, we've provided a NoOpProvider, which simply returns the default passed in.

class MyApp {
    public void example(){
        OpenFeatureAPI api = OpenFeatureAPI.getInstance();
        api.setProvider(new NoOpProvider());
        Client client = api.getClient();
        // Now use your `client` instance to evaluate some feature flags!
    }
}

Contacting us

We hold regular meetings which you can see here.

We are also present on the #openfeature channel in the CNCF slack.

Contributors

Thanks so much to our contributors.

Made with contrib.rocks.