Created
April 17, 2018 11:07
-
-
Save levlaz/51f667dc700f4630e4cb1b9145c0f71a to your computer and use it in GitHub Desktop.
Java Sample Code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.launchdarkly.client.*; | |
LDClient ldClient = new LDClient("YOUR_SDK_KEY"); | |
LDUser user = new LDUser.Builder("some_id") | |
// // 100% Optional | |
.firstName("Ernestina") | |
.lastName("Evans") | |
.email("[email protected]") | |
// Any arbitrary custom metadata can be passed along | |
.custom("groups", Arrays.asList("VIP") | |
.custom("country", Arrays.asList("UK")) | |
.custom("plan", Arrays.asList("silver")) | |
.custom("MRR", 500) | |
.custom("SignUpDate", "1/1/2017") | |
.custom("version", 11) | |
.build() | |
boolean showFeature = ldClient.boolVariation( | |
"beta-ui", | |
user, | |
false | |
); | |
if (showFeature) { | |
// application code to show the feature | |
newCode() | |
} | |
else { | |
oldCode() | |
// the code to run if the featnew-checkout-flowure is off | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment