Как решить ошибку:
error: Entities and Pojos must have a usable public constructor. You can have an empty constructor or a constructor whose parameters match the fields (by name and type).
Tried the following constructors but they failed to match:
Category(int,java.lang.String,java.lang.String,java.lang.String,java.lang.String,int,boolean,boolean,int) -> [param:n2 -> matched field:unmatched, param:string2 -> matched field:unmatched, param:string3 -> matched field:unmatched, param:string4 -> matched field:unmatched, param:string5 -> matched field:unmatched, param:n3 -> matched field:unmatched, param:bl -> matched field:unmatched, param:bl2 -> matched field:unmatched, param:n4 -> matched field:unmatched]
Пробовал искать в интернете, но там дают советы для Kotlin. Вот код:
@Entity
public class Category implements Comparable<Category>, MenuPosition {
@ColumnInfo(name="has_products")
private boolean hasProducts;
@ColumnInfo(name="has_subgroups")
private boolean hasSubgroups;
@PrimaryKey
private int id;
private String image;
@ColumnInfo(name="image_checksum")
private String imageChecksum;
@ColumnInfo(name="image_thumb")
private String imageThumb;
@ColumnInfo(name="parent_id")
private int parentId;
private int position;
private String title;
public Category(int n2, String string2, String string3, String string4, String string5, int n3, boolean bl, boolean bl2, int n4) {
this.id = n2;
this.image = string2;
this.imageThumb = string3;
this.imageChecksum = string4;
this.title = string5;
this.position = n3;
this.hasSubgroups = bl;
this.hasProducts = bl2;
this.parentId = n4;
}
@Override
public int compareTo(@NonNull Category category) {
return Integer.compare(this.position, category.position);
}
@Override
public String getIcon() {
return this.imageThumb;
}
@Override
public int getId() {
return this.id;
}
public String getImage() {
return this.image;
}
public String getImageChecksum() {
return this.imageChecksum;
}
public String getImageThumb() {
return this.imageThumb;
}
@Override
public String getImageUrl() {
return this.image;
}
@Override
public String getMenuTitle() {
return this.title;
}
public int getParentId() {
return this.parentId;
}
public int getPosition() {
return this.position;
}
public String getTitle() {
return this.title;
}
public boolean isHasProducts() {
return this.hasProducts;
}
public boolean isHasSubgroups() {
return this.hasSubgroups;
}
@Override
public boolean isProduct() {
return false;
}
public void setParentId(int n2) {
this.parentId = n2;
}
}
Продвижение своими сайтами как стратегия роста и независимости