// AUTOMATICALLY GENERATED BY OPENFEATURE CLI, DO NOT EDIT. package {{ .Params.Custom.JavaPackage }}; import dev.openfeature.sdk.Client; import dev.openfeature.sdk.EvaluationContext; import dev.openfeature.sdk.FlagEvaluationDetails; import dev.openfeature.sdk.OpenFeatureAPI; public final class OpenFeature { private OpenFeature() {} // prevent instantiation public interface GeneratedClient { {{ range .Flagset.Flags }} /** * {{ .Description }} * Details: * - Flag key: {{ .Key }} * - Type: {{ .Type | OpenFeatureType }} * - Default value: {{ .DefaultValue }} * Returns the flag value */ {{ .Type | OpenFeatureType }} {{ .Key | ToCamel }}(EvaluationContext ctx); /** * {{ .Description }} * Details: * - Flag key: {{ .Key }} * - Type: {{ .Type | OpenFeatureType }} * - Default value: {{ .DefaultValue }} * Returns the evaluation details containing the flag value and metadata */ FlagEvaluationDetails<{{ .Type | OpenFeatureType }}> {{ .Key | ToCamel }}Details(EvaluationContext ctx); {{ end }} } private static final class OpenFeatureGeneratedClient implements GeneratedClient { private final Client client; private OpenFeatureGeneratedClient(Client client) { this.client = client; } {{ range .Flagset.Flags }} @Override public {{ .Type | OpenFeatureType }} {{ .Key | ToCamel }}(EvaluationContext ctx) { return client.get{{ .Type | OpenFeatureType | ToPascal }}Value("{{ .Key }}", {{ . | FormatDefaultValue }}, ctx); } @Override public FlagEvaluationDetails<{{ .Type | OpenFeatureType }}> {{ .Key | ToCamel }}Details(EvaluationContext ctx) { return client.get{{ .Type | OpenFeatureType | ToPascal }}Details("{{ .Key }}", {{ . | FormatDefaultValue }}, ctx); } {{ end }} } public static GeneratedClient getClient() { return new OpenFeatureGeneratedClient(OpenFeatureAPI.getInstance().getClient()); } public static GeneratedClient getClient(String domain) { return new OpenFeatureGeneratedClient(OpenFeatureAPI.getInstance().getClient(domain)); } }