
com.configcat.Utils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of configcat-java-client Show documentation
Show all versions of configcat-java-client Show documentation
Java SDK for ConfigCat, a feature flag, feature toggle, and configuration management service. That lets you launch new features and change your software configuration remotely without actually (re)deploying code. ConfigCat even helps you do controlled roll-outs like canary releases and blue-green deployments.
The newest version!
package com.configcat;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.util.Locale;
final class Utils {
private Utils() { /* prevent from instantiation*/ }
static final Gson gson = new GsonBuilder().disableHtmlEscaping().create();
public static DecimalFormat getDecimalFormat() {
DecimalFormat decimalFormat = new DecimalFormat("0.#####");
decimalFormat.setDecimalFormatSymbols(DecimalFormatSymbols.getInstance(Locale.UK));
return decimalFormat;
}
public static Config deserializeConfig(String json) {
Config config = Utils.gson.fromJson(json, Config.class);
String salt = config.getPreferences().getSalt();
Segment[] segments = config.getSegments();
if (segments == null) {
segments = new Segment[]{};
}
for (Setting setting : config.getEntries().values()) {
setting.setConfigSalt(salt);
setting.setSegments(segments);
}
return config;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy