Skip to content

Fixing targeting locales #123

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions facebook4j-core/src/main/java/facebook4j/TargetingParameter.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@

import java.util.Collection;
import java.util.LinkedHashSet;
import java.util.Locale;
import java.util.Set;

/**
* @author Ryuji Yamashita - roundrop at gmail.com
* @author Dimitry Kudryavtsev - dimitry at mentful.com
* @since Facebook4J 2.0.0
*/
public class TargetingParameter implements java.io.Serializable {
Expand All @@ -49,10 +49,10 @@ public void setRegions(Set<TargetingGeoLocation> regions) {
this.regions = regions;
}

public void setLocales(Set<Locale> locales) {
public void setLocales(Set<String> locales) {
this.locales = new LinkedHashSet<String>();
for (Locale locale : locales) {
this.locales.add(locale.toString());
for (String locale : locales) {
this.locales.add(locale);
}
}

Expand Down Expand Up @@ -104,21 +104,21 @@ public TargetingParameter region(TargetingGeoLocation region) {
return this;
}

public TargetingParameter locales(Collection<Locale> locales) {
public TargetingParameter locales(Collection<String> locales) {
if (this.locales == null) {
this.locales = new LinkedHashSet<String>();
}
for (Locale locale : locales) {
this.locales.add(locale.toString());
for (String locale : locales) {
this.locales.add(locale);
}
return this;
}

public TargetingParameter locale(Locale locale) {
public TargetingParameter locale(String locale) {
if (locales == null) {
locales = new LinkedHashSet<String>();
}
locales.add(locale.toString());
locales.add(locale);
return this;
}

Expand Down