mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-28 21:33:53 +01:00
Convert few model classes to kotlin (#3270)
This commit is contained in:
parent
d0f97398a5
commit
b0be4970ef
86 changed files with 661 additions and 1300 deletions
|
|
@ -1,13 +0,0 @@
|
|||
package fr.free.nrw.commons.nearby.model;
|
||||
|
||||
public class NearbyResponse {
|
||||
private final NearbyResults results;
|
||||
|
||||
public NearbyResponse(NearbyResults results) {
|
||||
this.results = results;
|
||||
}
|
||||
|
||||
public NearbyResults getResults() {
|
||||
return results;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
package fr.free.nrw.commons.nearby.model
|
||||
|
||||
class NearbyResponse(val results: NearbyResults)
|
||||
|
|
@ -1,82 +0,0 @@
|
|||
package fr.free.nrw.commons.nearby.model;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class NearbyResultItem {
|
||||
private final ResultTuple item;
|
||||
private final ResultTuple wikipediaArticle;
|
||||
private final ResultTuple commonsArticle;
|
||||
private final ResultTuple location;
|
||||
private final ResultTuple label;
|
||||
private final ResultTuple icon;
|
||||
@SerializedName("class") private final ResultTuple className;
|
||||
@SerializedName("classLabel") private final ResultTuple classLabel;
|
||||
@SerializedName("commonsCategory") private final ResultTuple commonsCategory;
|
||||
@SerializedName("pic") private final ResultTuple pic;
|
||||
@SerializedName("destroyed") private final ResultTuple destroyed;
|
||||
|
||||
public NearbyResultItem(ResultTuple item,
|
||||
ResultTuple wikipediaArticle,
|
||||
ResultTuple commonsArticle,
|
||||
ResultTuple location,
|
||||
ResultTuple label,
|
||||
ResultTuple icon, ResultTuple className,
|
||||
ResultTuple classLabel,
|
||||
ResultTuple commonsCategory,
|
||||
ResultTuple pic,
|
||||
ResultTuple destroyed) {
|
||||
this.item = item;
|
||||
this.wikipediaArticle = wikipediaArticle;
|
||||
this.commonsArticle = commonsArticle;
|
||||
this.location = location;
|
||||
this.label = label;
|
||||
this.icon = icon;
|
||||
this.className = className;
|
||||
this.classLabel = classLabel;
|
||||
this.commonsCategory = commonsCategory;
|
||||
this.pic = pic;
|
||||
this.destroyed = destroyed;
|
||||
}
|
||||
|
||||
public ResultTuple getItem() {
|
||||
return item == null ? new ResultTuple(): item;
|
||||
}
|
||||
|
||||
public ResultTuple getWikipediaArticle() {
|
||||
return wikipediaArticle == null ? new ResultTuple():wikipediaArticle;
|
||||
}
|
||||
|
||||
public ResultTuple getCommonsArticle() {
|
||||
return commonsArticle == null ? new ResultTuple():commonsArticle;
|
||||
}
|
||||
|
||||
public ResultTuple getLocation() {
|
||||
return location == null ? new ResultTuple():location;
|
||||
}
|
||||
|
||||
public ResultTuple getLabel() {
|
||||
return label == null ? new ResultTuple():label;
|
||||
}
|
||||
|
||||
public ResultTuple getIcon() {
|
||||
return icon == null ? new ResultTuple():icon;
|
||||
}
|
||||
|
||||
public ResultTuple getClassName() {
|
||||
return className == null ? new ResultTuple():className;
|
||||
}
|
||||
|
||||
public ResultTuple getClassLabel() {
|
||||
return classLabel == null ? new ResultTuple():classLabel;
|
||||
}
|
||||
|
||||
public ResultTuple getCommonsCategory() {
|
||||
return commonsCategory == null ? new ResultTuple():commonsCategory;
|
||||
}
|
||||
public ResultTuple getPic() {
|
||||
return pic == null ? new ResultTuple():pic;
|
||||
}
|
||||
public ResultTuple getDestroyed() {
|
||||
return destroyed == null ? new ResultTuple(): destroyed;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
package fr.free.nrw.commons.nearby.model
|
||||
|
||||
import com.google.gson.annotations.SerializedName
|
||||
|
||||
class NearbyResultItem(private val item: ResultTuple?,
|
||||
private val wikipediaArticle: ResultTuple?,
|
||||
private val commonsArticle: ResultTuple?,
|
||||
private val location: ResultTuple?,
|
||||
private val label: ResultTuple?,
|
||||
private val icon: ResultTuple?, @field:SerializedName("class") private val className: ResultTuple?,
|
||||
@field:SerializedName("classLabel") private val classLabel: ResultTuple?,
|
||||
@field:SerializedName("commonsCategory") private val commonsCategory: ResultTuple?,
|
||||
@field:SerializedName("pic") private val pic: ResultTuple?,
|
||||
@field:SerializedName("destroyed") private val destroyed: ResultTuple?) {
|
||||
|
||||
fun getItem(): ResultTuple {
|
||||
return item ?: ResultTuple()
|
||||
}
|
||||
|
||||
fun getWikipediaArticle(): ResultTuple {
|
||||
return wikipediaArticle ?: ResultTuple()
|
||||
}
|
||||
|
||||
fun getCommonsArticle(): ResultTuple {
|
||||
return commonsArticle ?: ResultTuple()
|
||||
}
|
||||
|
||||
fun getLocation(): ResultTuple {
|
||||
return location ?: ResultTuple()
|
||||
}
|
||||
|
||||
fun getLabel(): ResultTuple {
|
||||
return label ?: ResultTuple()
|
||||
}
|
||||
|
||||
fun getIcon(): ResultTuple {
|
||||
return icon ?: ResultTuple()
|
||||
}
|
||||
|
||||
fun getClassName(): ResultTuple {
|
||||
return className ?: ResultTuple()
|
||||
}
|
||||
|
||||
fun getClassLabel(): ResultTuple {
|
||||
return classLabel ?: ResultTuple()
|
||||
}
|
||||
|
||||
fun getCommonsCategory(): ResultTuple {
|
||||
return commonsCategory ?: ResultTuple()
|
||||
}
|
||||
|
||||
fun getPic(): ResultTuple {
|
||||
return pic ?: ResultTuple()
|
||||
}
|
||||
|
||||
fun getDestroyed(): ResultTuple {
|
||||
return destroyed ?: ResultTuple()
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
package fr.free.nrw.commons.nearby.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class NearbyResults {
|
||||
private final List<NearbyResultItem> bindings;
|
||||
|
||||
public NearbyResults(List<NearbyResultItem> bindings) {
|
||||
this.bindings = bindings;
|
||||
}
|
||||
|
||||
public List<NearbyResultItem> getBindings() {
|
||||
return bindings;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
package fr.free.nrw.commons.nearby.model
|
||||
|
||||
class NearbyResults(val bindings: List<NearbyResultItem>)
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
package fr.free.nrw.commons.nearby.model;
|
||||
|
||||
public class ResultTuple {
|
||||
private final String type;
|
||||
private final String value;
|
||||
|
||||
public ResultTuple(String type, String value) {
|
||||
this.type = type;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public ResultTuple() {
|
||||
this.type = "";
|
||||
this.value = "";
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package fr.free.nrw.commons.nearby.model
|
||||
|
||||
class ResultTuple {
|
||||
val type: String
|
||||
val value: String
|
||||
|
||||
constructor(type: String, value: String) {
|
||||
this.type = type
|
||||
this.value = value
|
||||
}
|
||||
|
||||
constructor() {
|
||||
type = ""
|
||||
value = ""
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue