@@ -217,15 +217,15 @@ If the flag management system you're using supports targeting, you can provide t
217217// set a value to the global context
218218OpenFeatureAPI api = OpenFeatureAPI . getInstance();
219219Map<String , Value > apiAttrs = new HashMap<> ();
220- apiAttrs. put(" region" , new Value (System . getEnv( " us-east-1 " )));
220+ apiAttrs. put(" region" , new Value (System . getenv( " AWS_REGION " )));
221221EvaluationContext apiCtx = new ImmutableContext (apiAttrs);
222222api. setEvaluationContext(apiCtx);
223223
224224// set a value to the client context
225225Map<String , Value > clientAttrs = new HashMap<> ();
226- clientAttrs. put(" region" , new Value (System . getEnv( " us-east-1 " )));
226+ clientAttrs. put(" region" , new Value (System . getenv( " AWS_REGION " )));
227227EvaluationContext clientCtx = new ImmutableContext (clientAttrs);
228- Client client = api. getInstance() . getClient();
228+ Client client = api. getClient();
229229client. setEvaluationContext(clientCtx);
230230
231231// set a value to the invocation context
@@ -292,7 +292,7 @@ If a domain has no associated provider, the global provider is used.
292292FeatureProvider scopedProvider = new MyProvider ();
293293
294294// registering the default provider
295- OpenFeatureAPI . getInstance(). setProvider(LocalProvider());
295+ OpenFeatureAPI . getInstance(). setProvider(new LocalProvider ());
296296// registering a provider to a domain
297297OpenFeatureAPI . getInstance(). setProvider(" my-domain" , new CachedProvider ());
298298
@@ -452,25 +452,26 @@ This can be a new repository or included in [the existing contrib repository](ht
452452Implement your own hook by conforming to the ` Hook interface ` .
453453
454454``` java
455- class MyHook implements Hook {
455+ class MyHook implements Hook< Object > {
456456
457457 @Override
458- public Optional before (HookContext ctx , Map hints ) {
458+ public Optional< EvaluationContext > before (HookContext< Object > ctx , Map< String , Object > hints ) {
459459 // code that runs before the flag evaluation
460+ return Optional . empty();
460461 }
461462
462463 @Override
463- public void after (HookContext ctx , FlagEvaluationDetails details , Map hints ) {
464+ public void after (HookContext< Object > ctx , FlagEvaluationDetails< Object > details , Map< String , Object > hints ) {
464465 // code that runs after the flag evaluation succeeds
465466 }
466467
467468 @Override
468- public void error (HookContext ctx , Exception error , Map hints ) {
469+ public void error (HookContext< Object > ctx , Exception error , Map< String , Object > hints ) {
469470 // code that runs when there's an error during a flag evaluation
470471 }
471472
472473 @Override
473- public void finallyAfter (HookContext ctx , FlagEvaluationDetails details , Map hints ) {
474+ public void finallyAfter (HookContext< Object > ctx , FlagEvaluationDetails< Object > details , Map< String , Object > hints ) {
474475 // code that runs regardless of success or error
475476 }
476477};
0 commit comments