Skip to content

Commit

Permalink
[ch57098] Deprecate LDCountryCode (#141)
Browse files Browse the repository at this point in the history
Deprecate LDCountryCode class and LDUser setters that take LDCountryCode as an argument.
  • Loading branch information
gwhelanLD authored Nov 25, 2019
1 parent d1af310 commit c0e71ae
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@
*
* @author Takahiko Kawasaki
*/
@SuppressWarnings({"deprecation", "DeprecatedIsStillUsed"})
@Deprecated
public enum LDCountryCode {
/**
* <a href="http://en.wikipedia.org/wiki/Ascension_Island">Ascension Island</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ public static class Builder {
private String email;
private String name;
private String avatar;
@SuppressWarnings("deprecation")
private LDCountryCode country;

private final Map<String, JsonElement> custom;
Expand All @@ -232,6 +233,7 @@ public Builder(String key) {
privateAttributeNames = new HashSet<>();
}

@SuppressWarnings("deprecation")
public Builder(LDUser user) {
this.key = user.getKey();
this.anonymous = user.getAnonymous();
Expand Down Expand Up @@ -282,10 +284,12 @@ public Builder privateSecondary(String s) {
}

/**
* Set the country for a user. The country should be a valid <a
* Set the country for a user. In 2.x.x the SDK will attempt to look the country up as a <a
* href="http://en.wikipedia.org/wiki/ISO_3166-1">ISO 3166-1</a> alpha-2 or alpha-3 code. If
* it is not a valid ISO-3166-1 code, an attempt will be made to look up the country by its
* name. If that fails, a warning will be logged, and the country will not be set.
* name. If that fails, a warning will be logged, and the country will not be set. In the
* next major release (3.0.0) the SDK will not attempt attempt this lookup, and instead
* treat the country field as a normal String.
*
* @param s the country for the user
* @return the builder
Expand All @@ -296,11 +300,12 @@ public Builder country(String s) {
}

/**
* Set the country for a user. The country should be a valid <a
* Set the country for a user. In 2.x.x the SDK will attempt to look the country up as a <a
* href="http://en.wikipedia.org/wiki/ISO_3166-1">ISO 3166-1</a> alpha-2 or alpha-3 code. If
* it is not a valid ISO-3166-1 code, an attempt will be made to look up the country by its
* name. If that fails, a warning will be logged, and the country will not be set. Private
* attributes are not recorded in events.
* name. If that fails, a warning will be logged, and the country will not be set. In the
* next major release (3.0.0) the SDK will not attempt attempt this lookup, and instead
* treat the country field as a normal String. Private attributes are not recorded in events.
*
* @param s the country for the user
* @return the builder
Expand All @@ -310,6 +315,8 @@ public Builder privateCountry(String s) {
return country(s);
}


@SuppressWarnings("deprecation")
private LDCountryCode countryCode(String s) {
LDCountryCode countryCode = LDCountryCode.getByCode(s, false);

Expand Down Expand Up @@ -341,7 +348,11 @@ private LDCountryCode countryCode(String s) {
*
* @param country the country for the user
* @return the builder
*/
* @deprecated As of version 2.9.1, in 3.0.0 the SDK will no longer include the
* LDCountryCode class. Applications should use {@link #country(String)} instead.
* */
@Deprecated
@SuppressWarnings("deprecation")
public Builder country(LDCountryCode country) {
this.country = country;
return this;
Expand All @@ -352,7 +363,11 @@ public Builder country(LDCountryCode country) {
*
* @param country the country for the user
* @return the builder
* @deprecated As of version 2.9.1, in 3.0.0 the SDK will no longer include the
* LDCountryCode class. Applications should use {@link #privateCountry(String)} instead.
*/
@Deprecated
@SuppressWarnings("deprecation")
public Builder privateCountry(LDCountryCode country) {
privateAttributeNames.add(COUNTRY);
return country(country);
Expand Down

0 comments on commit c0e71ae

Please sign in to comment.