Skip to content

Commit 54e38a1

Browse files
author
Mike Davis
authored
Add clear deprecation path from factory builder method. (#327)
1 parent a4e3ba2 commit 54e38a1

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

core-api/src/main/java/com/optimizely/ab/Optimizely.java

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -967,6 +967,22 @@ public <T> int addNotificationHandler(Class<T> clazz, NotificationHandler<T> han
967967
}
968968

969969
//======== Builder ========//
970+
971+
/**
972+
* This overloaded factory method is deprecated in favor of pure builder methods.
973+
* Please use {@link com.optimizely.ab.Optimizely#builder()} along with
974+
* {@link Builder#withDatafile(java.lang.String)} and
975+
* {@link Builder#withEventHandler(com.optimizely.ab.event.EventHandler)}
976+
* respectively.
977+
*
978+
* Example:
979+
* <pre>
980+
* Optimizely optimizely = Optimizely.builder()
981+
* .withDatafile(datafile)
982+
* .withEventHandler(eventHandler)
983+
* .build();
984+
* </pre>
985+
*/
970986
@Deprecated
971987
public static Builder builder(@Nonnull String datafile,
972988
@Nonnull EventHandler eventHandler) {
@@ -1054,12 +1070,12 @@ public Builder withNotificationCenter(NotificationCenter notificationCenter) {
10541070
return this;
10551071
}
10561072

1057-
// Helper function for making testing easier
1058-
protected Builder withDatafile(String datafile) {
1073+
public Builder withDatafile(String datafile) {
10591074
this.datafile = datafile;
10601075
return this;
10611076
}
10621077

1078+
// Helper functions for making testing easier
10631079
protected Builder withBucketing(Bucketer bucketer) {
10641080
this.bucketer = bucketer;
10651081
return this;

0 commit comments

Comments
 (0)