Package com.adobe.granite.toggle.api
Interface ToggleRouter
-
@ProviderType public interface ToggleRouter
Toggle router provides information about enabled toggles to clients. Clients should not cache the result of an enabled check beyond a thread of execution as the toggles might flip at any time.Checking a toggle is a fast operation which immediately returns the result.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description java.lang.String
getAPIKey()
Deprecated.java.util.Collection<java.lang.String>
getEnabledToggleNames()
Return the names of all currently enabled togglesReleaseChannel
getReleaseChannel()
Returns a release channel enum value.java.lang.String
getStateQualifier()
Get a string identifying the current state of the toggles.java.util.Map<java.lang.String,java.lang.String>
getToggleContext()
Returns a key-value map of toggle context attributesjava.lang.String
getToggleValue(java.lang.String name)
Get the value of a toggle - for boolean toggles this returns the string value "true".boolean
isEnabled(java.lang.String name)
Check whether a toggle is currently enabled.boolean
isEnabled(java.lang.String... names)
Check whether a set of toggles is currently enabled.
-
-
-
Method Detail
-
isEnabled
boolean isEnabled(java.lang.String name)
Check whether a toggle is currently enabled.- Parameters:
name
- The toggle name- Returns:
true
if the toggle is enabled.
-
isEnabled
boolean isEnabled(java.lang.String... names)
Check whether a set of toggles is currently enabled.- Parameters:
names
- The toggle names- Returns:
true
if all toggles are enabled.
-
getEnabledToggleNames
java.util.Collection<java.lang.String> getEnabledToggleNames()
Return the names of all currently enabled toggles- Returns:
- A unmodifiable collection of names.
-
getAPIKey
@Deprecated java.lang.String getAPIKey()
Deprecated.This method is deprecated and must not be used anymore- Returns:
- Not specified
-
getStateQualifier
java.lang.String getStateQualifier()
Get a string identifying the current state of the toggles. This qualifier helps identifying whether the toggle state has changed. A possible implementation might just increase a counter or use a timestamp.- Returns:
- A state qualifier
-
getToggleContext
java.util.Map<java.lang.String,java.lang.String> getToggleContext()
Returns a key-value map of toggle context attributes- Returns:
- toggle context map
-
getReleaseChannel
ReleaseChannel getReleaseChannel()
Returns a release channel enum value.- Returns:
- one of LIVE, PRERELEASE, NEXT or FUTURE
-
getToggleValue
java.lang.String getToggleValue(java.lang.String name)
Get the value of a toggle - for boolean toggles this returns the string value "true".- Parameters:
name
- The toggle name- Returns:
- The value of the toggle or null if the toggle is not enabled.
- Since:
- 1.4
-
-