Experiment with unifying Artwork interface for all databases

This commit is contained in:
Reinhard Pointner 2016-04-19 10:05:16 +00:00
parent d616f5ab3f
commit 90ecf3c0a7
1 changed files with 5 additions and 3 deletions

View File

@ -45,8 +45,8 @@ public class Artwork implements Serializable {
return url; return url;
} }
public String getLanguage() { public Locale getLanguage() {
return language; return language == null ? null : new Locale(language);
} }
public double getRating() { public double getRating() {
@ -54,7 +54,9 @@ public class Artwork implements Serializable {
} }
public boolean matches(String... tags) { public boolean matches(String... tags) {
return stream(tags).filter(Objects::nonNull).allMatch(tag -> stream(category).anyMatch(tag::equals)); return stream(tags).filter(Objects::nonNull).allMatch(tag -> {
return stream(category).anyMatch(tag::equalsIgnoreCase) || tag.equalsIgnoreCase(language);
});
} }
@Override @Override