Creating a number flag
This section describes how to define a number flag.
Understanding number flags
Number flags are flags that can have multiple number values. When you create a number flag in your application, you define the default value and all the other values this flag can have. Like simple boolean flags, the number flag name is derived from the flag variable name.
Creating a container class and defining a feature flag
To add a number flag, you need two things:
-
A container class for your flags
-
A defined flag inside the container class
In the example below, a number flag is defined with the name
titleSize
. The flag name is derived from the flag variable name. The
titleSize
flag has a default value of 12.
If you need a number flag to be more dynamic with regards to value, you can define a number flag in the code with only one value (which is also the default value). This will result in a Free Text input field when configuring the flag’s through the CloudBees Feature Management dashboard. |
In the example below, the title size can be any one of 12, 14, 18 and 24. By default, it will be 12.
React Native | JavaScript | Node.js | JavaScript SSR | .NET | Python | Android | JDK |
---|---|---|---|---|---|---|---|
|
|
|
|
|
|
|
|
Registering the container class
Once you have the container class, you need to register its instance to
the CloudBees Feature Management SDK. This is done with the Rox.register
SDK function.
The namespace parameter is a logical separation between containers and can be used to find flags on the dashboard.
|
React Native | JavaScript | Node.js | JavaScript SSR | .NET | Python | Android | JDK |
---|---|---|---|---|---|---|---|
|
|
|
|
|
|
|
|
Using a number flag
React Native | JavaScript | Node.js | JavaScript SSR | .NET | Python | Android | JDK |
---|---|---|---|---|---|---|---|
|
|
|
|
|
|
|
|
Flag freeze level Flag freeze is available on client side SDKs by default.
See Understanding a flag freeze for more information. |