Как установить значения класса pojo в android ,,, .. В приведенном ниже коде, как установить значения объектов класса sportMembership и ExtraField - PullRequest
0 голосов
/ 23 апреля 2020
public class AddInvoiceRequestBodyPOJO {
    public AddInvoiceRequestBodyPOJO(Integer userId, Integer month, Integer year, Integer sessionCharges, List<SportMembership> sportMembership, List<ExtraFee> extraFees) {
        this.userId = userId;
        this.month = month;
        this.year = year;
        this.sessionCharges = sessionCharges;
        this.sportMembership = sportMembership;
        this.extraFees = extraFees;
    }

    @SerializedName("user_id")
    @Expose
    private Integer userId;
    @SerializedName("month")
    @Expose
    private Integer month;
    @SerializedName("year")
    @Expose
    private Integer year;
    @SerializedName("session_charges")
    @Expose
    private Integer sessionCharges;
    @SerializedName("sport_membership")
    @Expose
    private List<SportMembership> sportMembership = null;
    @SerializedName("extra_fees")
    @Expose
    private List<ExtraFee> extraFees = null;

    public Integer getUserId() {
        return userId;
    }

    public void setUserId(Integer userId) {
        this.userId = userId;
    }

    public Integer getMonth() {
        return month;
    }

    public void setMonth(Integer month) {
        this.month = month;
    }

    public Integer getYear() {
        return year;
    }

    public void setYear(Integer year) {
        this.year = year;
    }

    public Integer getSessionCharges() {
        return sessionCharges;
    }

    public void setSessionCharges(Integer sessionCharges) {
        this.sessionCharges = sessionCharges;
    }

    public List<SportMembership> getSportMembership() {
        return sportMembership;
    }

    public void setSportMembership(List<SportMembership> sportMembership) {
        this.sportMembership = sportMembership;
    }

    public List<ExtraFee> getExtraFees() {
        return extraFees;
    }

    public void setExtraFees(List<ExtraFee> extraFees) {
        this.extraFees = extraFees;
    }

    public class ExtraFee {

        public ExtraFee(String category, Integer amount, Integer discount, String notes) {
            this.category = category;
            this.amount = amount;
            this.discount = discount;
            this.notes = notes;
        }

        @SerializedName("category")
        @Expose
        private String category;
        @SerializedName("amount")
        @Expose
        private Integer amount;
        @SerializedName("discount")
        @Expose
        private Integer discount;
        @SerializedName("notes")
        @Expose
        private String notes;

        public String getCategory() {
            return category;
        }

        public void setCategory(String category) {
            this.category = category;
        }

        public Integer getAmount() {
            return amount;
        }

        public void setAmount(Integer amount) {
            this.amount = amount;
        }

        public Integer getDiscount() {
            return discount;
        }

        public void setDiscount(Integer discount) {
            this.discount = discount;
        }

        public String getNotes() {
            return notes;
        }

        public void setNotes(String notes) {
            this.notes = notes;
        }

    }

    public class SportMembership {

        @SerializedName("sport_id")
        @Expose
        private Integer sportId;
        @SerializedName("discount")
        @Expose
        private Integer discount;
        @SerializedName("notes")
        @Expose
        private String notes;

        public SportMembership(Integer sportId, Integer discount, String notes) {
            this.sportId = sportId;
            this.discount = discount;
            this.notes = notes;
        }

        public Integer getSportId() {
            return sportId;
        }

        public void setSportId(Integer sportId) {
            this.sportId = sportId;
        }

        public Integer getDiscount() {
            return discount;
        }

        public void setDiscount(Integer discount) {
            this.discount = discount;
        }

        public String getNotes() {
            return notes;
        }

        public void setNotes(String notes) {
            this.notes = notes;
        }

    }
}
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...