mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-28 05:13:53 +01:00
46 lines
1,012 B
Java
46 lines
1,012 B
Java
package fr.free.nrw.commons;
|
|
|
|
public class License {
|
|
String key;
|
|
String template;
|
|
String url;
|
|
String name;
|
|
|
|
public License(String key, String template, String url, String name) {
|
|
if (key == null) {
|
|
throw new RuntimeException("License.key must not be null");
|
|
}
|
|
if (template == null) {
|
|
throw new RuntimeException("License.template must not be null");
|
|
}
|
|
this.key = key;
|
|
this.template = template;
|
|
this.url = url;
|
|
this.name = name;
|
|
}
|
|
|
|
public String getKey() {
|
|
return key;
|
|
}
|
|
|
|
public String getTemplate() {
|
|
return template;
|
|
}
|
|
|
|
public String getName() {
|
|
if (name == null) {
|
|
// hack
|
|
return getKey();
|
|
} else {
|
|
return name;
|
|
}
|
|
}
|
|
|
|
public String getUrl(String language) {
|
|
if (url == null) {
|
|
return null;
|
|
} else {
|
|
return url.replace("$lang", language);
|
|
}
|
|
}
|
|
}
|