@@ -416,6 +416,162 @@ Double getVariableDouble(@Nonnull String variableKey,
416416 return null ;
417417 }
418418
419+ //======== Feature APIs ========//
420+
421+ /**
422+ * Determine whether a boolean feature is enabled.
423+ * Send an impression event if the user is bucketed into an experiment using the feature.
424+ *
425+ * @param featureKey The unique key of the feature.
426+ * @param userId The ID of the user.
427+ * @return True if the feature is enabled.
428+ * False if the feature is disabled.
429+ * Will always return True if toggling the feature is disabled.
430+ * Will return Null if the feature is not found.
431+ */
432+ public @ Nullable Boolean isFeatureEnabled (@ Nonnull String featureKey ,
433+ @ Nonnull String userId ) {
434+ return isFeatureEnabled (featureKey , userId , Collections .<String , String >emptyMap ());
435+ }
436+
437+ /**
438+ * Determine whether a boolean feature is enabled.
439+ * Send an impression event if the user is bucketed into an experiment using the feature.
440+ *
441+ * @param featureKey The unique key of the feature.
442+ * @param userId The ID of the user.
443+ * @param attributes The user's attributes.
444+ * @return True if the feature is enabled.
445+ * False if the feature is disabled.
446+ * Will always return True if toggling the feature is disabled.
447+ * Will return Null if the feature is not found.
448+ */
449+ public @ Nullable Boolean isFeatureEnabled (@ Nonnull String featureKey ,
450+ @ Nonnull String userId ,
451+ @ Nonnull Map <String , String > attributes ) {
452+ return getFeatureVariableBoolean (featureKey , "" , userId , attributes );
453+ }
454+
455+ /**
456+ * Get the Boolean value of the specified variable in the feature.
457+ * @param featureKey The unique key of the feature.
458+ * @param variableKey The unique key of the variable.
459+ * @param userId The ID of the user.
460+ * @return The Boolean value of the boolean single variable feature.
461+ * Null if the feature could not be found.
462+ */
463+ public @ Nullable Boolean getFeatureVariableBoolean (@ Nonnull String featureKey ,
464+ @ Nonnull String variableKey ,
465+ @ Nonnull String userId ) {
466+ return getFeatureVariableBoolean (featureKey , variableKey , userId , Collections .<String , String >emptyMap ());
467+ }
468+
469+ /**
470+ * Get the Boolean value of the specified variable in the feature.
471+ * @param featureKey The unique key of the feature.
472+ * @param variableKey The unique key of the variable.
473+ * @param userId The ID of the user.
474+ * @param attributes The user's attributes.
475+ * @return The Boolean value of the boolean single variable feature.
476+ * Null if the feature or variable could not be found.
477+ */
478+ public @ Nullable Boolean getFeatureVariableBoolean (@ Nonnull String featureKey ,
479+ @ Nonnull String variableKey ,
480+ @ Nonnull String userId ,
481+ @ Nonnull Map <String , String > attributes ) {
482+ return null ;
483+ }
484+
485+ /**
486+ * Get the Double value of the specified variable in the feature.
487+ * @param featureKey The unique key of the feature.
488+ * @param variableKey The unique key of the variable.
489+ * @param userId The ID of the user.
490+ * @return The Double value of the double single variable feature.
491+ * Null if the feature or variable could not be found.
492+ */
493+ public @ Nullable Double getFeatureVariableDouble (@ Nonnull String featureKey ,
494+ @ Nonnull String variableKey ,
495+ @ Nonnull String userId ) {
496+ return getFeatureVariableDouble (featureKey , variableKey , userId , Collections .<String , String >emptyMap ());
497+ }
498+
499+ /**
500+ * Get the Double value of the specified variable in the feature.
501+ * @param featureKey The unique key of the feature.
502+ * @param variableKey The unique key of the variable.
503+ * @param userId The ID of the user.
504+ * @param attributes The user's attributes.
505+ * @return The Double value of the double single variable feature.
506+ * Null if the feature or variable could not be found.
507+ */
508+ public @ Nullable Double getFeatureVariableDouble (@ Nonnull String featureKey ,
509+ @ Nonnull String variableKey ,
510+ @ Nonnull String userId ,
511+ @ Nonnull Map <String , String > attributes ) {
512+ return null ;
513+ }
514+
515+ /**
516+ * Get the Integer value of the specified variable in the feature.
517+ * @param featureKey The unique key of the feature.
518+ * @param variableKey The unique key of the variable.
519+ * @param userId The ID of the user.
520+ * @return The Integer value of the integer single variable feature.
521+ * Null if the feature or variable could not be found.
522+ */
523+ public @ Nullable Integer getFeatureVariableInteger (@ Nonnull String featureKey ,
524+ @ Nonnull String variableKey ,
525+ @ Nonnull String userId ) {
526+ return getFeatureVariableInteger (featureKey , variableKey , userId , Collections .<String , String >emptyMap ());
527+ }
528+
529+ /**
530+ * Get the Integer value of the specified variable in the feature.
531+ * @param featureKey The unique key of the feature.
532+ * @param variableKey The unique key of the variable.
533+ * @param userId The ID of the user.
534+ * @param attributes The user's attributes.
535+ * @return The Integer value of the integer single variable feature.
536+ * Null if the feature or variable could not be found.
537+ */
538+ public @ Nullable Integer getFeatureVariableInteger (@ Nonnull String featureKey ,
539+ @ Nonnull String variableKey ,
540+ @ Nonnull String userId ,
541+ @ Nonnull Map <String , String > attributes ) {
542+ return null ;
543+ }
544+
545+ /**
546+ * Get the String value of the specified variable in the feature.
547+ * @param featureKey The unique key of the feature.
548+ * @param variableKey The unique key of the variable.
549+ * @param userId The ID of the user.
550+ * @return The String value of the string single variable feature.
551+ * Null if the feature or variable could not be found.
552+ */
553+ public @ Nullable String getFeatureVariableString (@ Nonnull String featureKey ,
554+ @ Nonnull String variableKey ,
555+ @ Nonnull String userId ) {
556+ return getFeatureVariableString (featureKey , variableKey , userId , Collections .<String , String >emptyMap ());
557+ }
558+
559+ /**
560+ * Get the String value of the specified variable in the feature.
561+ * @param featureKey The unique key of the feature.
562+ * @param variableKey The unique key of the variable.
563+ * @param userId The ID of the user.
564+ * @param attributes The user's attributes.
565+ * @return The String value of the string single variable feature.
566+ * Null if the feature or variable could not be found.
567+ */
568+ public @ Nullable String getFeatureVariableString (@ Nonnull String featureKey ,
569+ @ Nonnull String variableKey ,
570+ @ Nonnull String userId ,
571+ @ Nonnull Map <String , String > attributes ) {
572+ return null ;
573+ }
574+
419575 //======== getVariation calls ========//
420576
421577 public @ Nullable
0 commit comments