Commit e2407e30 authored by Trio Saputra's avatar Trio Saputra

adding entities

parent 2ca49649
package com.example.yourcashiertest.daos; package com.example.yourcashiertest.daos;
public interface ProductDao { public interface ProductDao {
} }
package com.example.yourcashiertest.databases; package com.example.yourcashiertest.databases;
public class LocalDatabase { public class LocalDatabase {
} }
package com.example.yourcashiertest.entities; package com.example.yourcashiertest.entities;
public class Product { import android.os.Parcel;
import android.os.Parcelable;
import androidx.room.PrimaryKey;
public class Product implements Parcelable {
@PrimaryKey(autoGenerate = true)
private long id;
private long price, quantity;
private String photo = "", name = "", description = "", category = "";
public Product(long price, long quantity, String photo, String name, String description, String category) {
this.price = price;
this.quantity = quantity;
this.photo = photo;
this.name = name;
this.description = description;
this.category = category;
}
protected Product(Parcel in) {
id = in.readLong();
price = in.readLong();
quantity = in.readLong();
photo = in.readString();
name = in.readString();
description = in.readString();
category = in.readString();
}
public static final Creator<Product> CREATOR = new Creator<Product>() {
@Override
public Product createFromParcel(Parcel in) {
return new Product(in);
}
@Override
public Product[] newArray(int size) {
return new Product[size];
}
};
public long getPrice() {
return price;
}
public void setPrice(long price) {
this.price = price;
}
public long getQuantity() {
return quantity;
}
public void setQuantity(long quantity) {
this.quantity = quantity;
}
public String getPhoto() {
return photo;
}
public void setPhoto(String photo) {
this.photo = photo;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel parcel, int i) {
parcel.writeLong(id);
parcel.writeLong(price);
parcel.writeLong(quantity);
parcel.writeString(photo);
parcel.writeString(name);
parcel.writeString(description);
parcel.writeString(category);
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment