Skip to content

Commit 142968e

Browse files
author
Mike Davis
committed
Add clear deprecation path from factory builder method. (#327)
1 parent df8e9d7 commit 142968e

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
@@ -986,6 +986,22 @@ public <T> int addNotificationHandler(Class<T> clazz, NotificationHandler<T> han
986986
}
987987

988988
//======== Builder ========//
989+
990+
/**
991+
* This overloaded factory method is deprecated in favor of pure builder methods.
992+
* Please use {@link com.optimizely.ab.Optimizely#builder()} along with
993+
* {@link Builder#withDatafile(java.lang.String)} and
994+
* {@link Builder#withEventHandler(com.optimizely.ab.event.EventHandler)}
995+
* respectively.
996+
*
997+
* Example:
998+
* <pre>
999+
* Optimizely optimizely = Optimizely.builder()
1000+
* .withDatafile(datafile)
1001+
* .withEventHandler(eventHandler)
1002+
* .build();
1003+
* </pre>
1004+
*/
9891005
@Deprecated
9901006
public static Builder builder(@Nonnull String datafile,
9911007
@Nonnull EventHandler eventHandler) {
@@ -1067,12 +1083,12 @@ public Builder withNotificationCenter(NotificationCenter notificationCenter) {
10671083
return this;
10681084
}
10691085

1070-
// Helper function for making testing easier
1071-
protected Builder withDatafile(String datafile) {
1086+
public Builder withDatafile(String datafile) {
10721087
this.datafile = datafile;
10731088
return this;
10741089
}
10751090

1091+
// Helper functions for making testing easier
10761092
protected Builder withBucketing(Bucketer bucketer) {
10771093
this.bucketer = bucketer;
10781094
return this;

0 commit comments

Comments
 (0)