Shipeasy
ReferenceJava

OpenFeature provider

The Java SDK ships a server OpenFeature provider — ai.shipeasy.openfeature.ShipeasyProvider — so apps standardized on the CNCF OpenFeature API can plug…

Generated from the SDK's own /docs/ — also served raw at https://shipeasy-ai.github.io/sdk-java/pages/openfeature.md.

The Java SDK ships a server OpenFeature provider — ai.shipeasy.openfeature.ShipeasyProvider — so apps standardized on the CNCF OpenFeature API can plug Shipeasy in as the backing provider.

dev.openfeature:sdk is a provided-scope dependency: the consuming app supplies it, and non-OpenFeature users never load this class.

Wiring

Assumes Shipeasy.configure(...) ran at startup — see Installation. The no-arg new ShipeasyProvider() resolves the configured global engine, so OpenFeature is wired without naming the engine:

import dev.openfeature.sdk.OpenFeatureAPI;
import dev.openfeature.sdk.MutableContext;
import ai.shipeasy.openfeature.ShipeasyProvider;

// new ShipeasyProvider() (no arg) resolves the engine built by Shipeasy.configure(...)
OpenFeatureAPI.getInstance().setProviderAndWait(new ShipeasyProvider());

var of = OpenFeatureAPI.getInstance().getClient();
boolean on = of.getBooleanValue("new_checkout", false, new MutableContext("u1"));

setProviderAndWait triggers initialize, which loads the rules blob once; OpenFeature fires Ready on return.

How values map

The provider is a pure adapter — no change to evaluation:

  • Booleans → gate evaluation.
  • Strings, integers, doubles, objects → dynamic configs, with type coercion. A wrong-typed config returns the default with TYPE_MISMATCH.

Context → user

The OpenFeature targetingKey becomes Shipeasy's user_id; every other context attribute is carried through verbatim for targeting.

Reason mapping

The provider maps Shipeasy FlagDetail reasons onto OpenFeature reasons:

Shipeasy reasonOpenFeature reasonError code
RULE_MATCHTARGETING_MATCH
DEFAULTDEFAULT
OFFDISABLED
OVERRIDESTATIC
FLAG_NOT_FOUNDERRORFLAG_NOT_FOUND
CLIENT_NOT_READYERRORPROVIDER_NOT_READY
Was this page helpful?
✎ Edit this page

On this page