/** * Get a registered FeatureFlag by name. * * @param name Name of the FeatureFlag to get * * @return The feature flag with the given name * @throws BadApiRequestException if no feature flag has been registered for that name */ public FeatureFlag forName(String name) throws BadApiRequestException { FeatureFlag flag = NAMES_TO_VALUES.get(name.toUpperCase(Locale.ENGLISH)); return flag != null ? flag : Utils.insteadThrowRuntime( new BadApiRequestException("Invalid feature flag: " + name) ); }