docs: update feature toggle

This commit is contained in:
Ilkka Seppälä
2024-05-26 07:35:00 +03:00
parent cbf1c77008
commit 3035f40334
2 changed files with 72 additions and 25 deletions
@@ -71,13 +71,18 @@ public class App {
*/
public static void main(String[] args) {
// Demonstrates the PropertiesFeatureToggleVersion running with properties
// that set the feature toggle to enabled.
final var properties = new Properties();
properties.put("enhancedWelcome", true);
var service = new PropertiesFeatureToggleVersion(properties);
final var welcomeMessage = service.getWelcomeMessage(new User("Jamie No Code"));
LOGGER.info(welcomeMessage);
// ---------------------------------------------
// Demonstrates the PropertiesFeatureToggleVersion running with properties
// that set the feature toggle to disabled. Note the difference in the printed welcome message
// where the username is not included.
final var turnedOff = new Properties();
turnedOff.put("enhancedWelcome", false);
@@ -86,7 +91,11 @@ public class App {
turnedOffService.getWelcomeMessage(new User("Jamie No Code"));
LOGGER.info(welcomeMessageturnedOff);
// --------------------------------------------
// Demonstrates the TieredFeatureToggleVersion setup with
// two users: one on the free tier and the other on the paid tier. When the
// Service#getWelcomeMessage(User) method is called with the paid user, the welcome
// message includes their username. In contrast, calling the same service with the free tier user results
// in a more generic welcome message without the username.
var service2 = new TieredFeatureToggleVersion();