All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.elibom.client.Account Maven / Gradle / Ivy

There is a newer version: 0.2.7
Show newest version
package com.elibom.client;

import java.math.BigDecimal;

import org.json.JSONException;
import org.json.JSONObject;

/**
 *
 * @author Germán Escobar
 */
public class Account {

    private JSONObject json;

    private String name;

    private BigDecimal credits;

    private long ownerId;

    public Account(JSONObject json) throws JSONException {
        this.json = json;
        this.name = json.getString("name");
        if (json.has("credits")) {
            this.credits = new BigDecimal(json.getString("credits"));
        }
        this.ownerId = json.getJSONObject("owner").getLong("id");
    }

    public String getName() {
        return name;
    }

    public BigDecimal getCredits() {
        return credits;
    }

    public long getOwnerId() {
        return ownerId;
    }

    @Override
    public String toString() {
        return json.toString();
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy