java-sdk icon indicating copy to clipboard operation
java-sdk copied to clipboard

[TRACKING] breaking changes with API changes to consider with v2

Open Kavindu-Dodan opened this issue 1 year ago • 1 comments

This is a tracking issue with breaking changes such as @Deprecated annotated methods.

The resulting PR should be marked with breaking changes so that we can upgrade to the next major version (2.x)

List of tasks,

  • [ ] public OpenFeatureClient : remove public access and make interna
  • [ ] consider using Number for numeric evaluations
  • [ ] rethink lombok and object creation
  • [ ] Add a method to the Hook interface, through which the user can add hook data that can be accessed in a type safe manner during the flag evaluation:
class MyHook implements Hook<T,D>{
   D getHookData(){
      return myHookData;
   }

   void void after(HookContext<T> ctx, FlagEvaluationDetails<T> details, Map<String, Object> hints) {}
      D data = ctx.getHookData(); // data == myHookData
   }
}

Kavindu-Dodan avatar Mar 27 '24 18:03 Kavindu-Dodan

We might also want to rethink our getters? should we maybe think already about records in the future and didge our usual getters in favor of accessors in a record kind of style?

interface EvaluationContext {
    // getter style
   String getFlagKey();

   // record style
   String flagKey();
}

as records will generate this accessor automatically for eg.

record ImmutableEvaluationContext(String flagKey)

aepfli avatar Sep 21 '25 10:09 aepfli