com.chargebee.internal
Class Resource<T>

java.lang.Object
  extended by com.chargebee.internal.Resource<T>
Type Parameters:
T - The concrete type of the model
Direct Known Subclasses:
Addon, Address, Card, Comment, Coupon, CouponCode, CouponSet, CreditNote, CreditNote.Allocation, CreditNote.Discount, CreditNote.LineItem, CreditNote.LineItemDiscount, CreditNote.LineItemTax, CreditNote.LinkedRefund, CreditNote.Tax, CreditNoteEstimate, CreditNoteEstimate.Discount, CreditNoteEstimate.LineItem, CreditNoteEstimate.LineItemDiscount, CreditNoteEstimate.LineItemTax, CreditNoteEstimate.Tax, Customer, Customer.Balance, Customer.BillingAddress, Customer.Contact, Customer.PaymentMethod, Customer.ReferralUrl, Download, Estimate, Event, Event.Webhook, HostedPage, Invoice, Invoice.AdjustmentCreditNote, Invoice.AppliedCredit, Invoice.BillingAddress, Invoice.Discount, Invoice.IssuedCreditNote, Invoice.LineItem, Invoice.LineItemDiscount, Invoice.LineItemTax, Invoice.LinkedOrder, Invoice.LinkedPayment, Invoice.Note, Invoice.ShippingAddress, Invoice.Tax, InvoiceEstimate, InvoiceEstimate.Discount, InvoiceEstimate.LineItem, InvoiceEstimate.LineItemDiscount, InvoiceEstimate.LineItemTax, InvoiceEstimate.Tax, Order, PaymentSource, PaymentSource.AmazonPayment, PaymentSource.BankAccount, PaymentSource.Card, PaymentSource.Paypal, Plan, PortalSession, PortalSession.LinkedCustomer, PromotionalCredit, ResourceMigration, SiteMigrationDetail, Subscription, Subscription.Addon, Subscription.Coupon, Subscription.ReferralInfo, Subscription.ShippingAddress, SubscriptionEstimate, SubscriptionEstimate.ShippingAddress, ThirdPartyPaymentMethod, TimeMachine, Transaction, Transaction.LinkedCreditNote, Transaction.LinkedInvoice, Transaction.LinkedRefund, UnbilledCharge

public class Resource<T>
extends Object

Base class for the ChargeBee model objects


Field Summary
 org.json.JSONObject jsonObj
           
 
Constructor Summary
Resource(BufferedReader rd)
           
Resource(InputStream is)
           
Resource(org.json.JSONObject jsonObj)
           
Resource(String jsonStr)
           
 
Method Summary
protected static void apiVersionCheck(org.json.JSONObject jsonObj)
           
protected static String nullCheck(String id)
           
 BigDecimal optBigDecimal(String key)
           
 Boolean optBoolean(String key)
           
 Double optDouble(String key)
           
<E extends Enum>
E
optEnum(String key, Class<E> enumClass)
           
 Integer optInteger(String key)
           
 org.json.JSONObject optJSONObject(String key)
           
<S> List<S>
optList(String key, Class<S> claz)
           
 Long optLong(String key)
           
 String optString(String key)
           
<S extends Resource>
S
optSubResource(String key, Class<S> claz)
           
 Timestamp optTimestamp(String key)
           
 BigDecimal reqBigDecimal(String key)
           
 Boolean reqBoolean(String key)
           
 Double reqDouble(String key)
           
<E extends Enum>
E
reqEnum(String key, Class<E> enumClass)
           
 Integer reqInteger(String key)
           
 org.json.JSONObject reqJSONObject(String key)
           
<S extends Resource>
List<S>
reqList(String key, Class<S> claz)
           
 Long reqLong(String key)
           
 String reqString(String key)
           
<S extends Resource>
S
reqSubResource(String key, Class<S> claz)
           
 Timestamp reqTimestamp(String key)
           
 String toJson()
           
 String toString()
           
protected static String uri(String... paths)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

jsonObj

public org.json.JSONObject jsonObj
Constructor Detail

Resource

public Resource(org.json.JSONObject jsonObj)

Resource

public Resource(String jsonStr)

Resource

public Resource(InputStream is)
         throws IOException
Throws:
IOException

Resource

public Resource(BufferedReader rd)
         throws IOException
Throws:
IOException
Method Detail

reqString

public String reqString(String key)

optString

public String optString(String key)

reqBoolean

public Boolean reqBoolean(String key)

optBoolean

public Boolean optBoolean(String key)

reqInteger

public Integer reqInteger(String key)

optInteger

public Integer optInteger(String key)

reqBigDecimal

public BigDecimal reqBigDecimal(String key)

optBigDecimal

public BigDecimal optBigDecimal(String key)

reqDouble

public Double reqDouble(String key)

optDouble

public Double optDouble(String key)

reqLong

public Long reqLong(String key)

optLong

public Long optLong(String key)

reqJSONObject

public org.json.JSONObject reqJSONObject(String key)

optJSONObject

public org.json.JSONObject optJSONObject(String key)

reqTimestamp

public Timestamp reqTimestamp(String key)

optTimestamp

public Timestamp optTimestamp(String key)

reqEnum

public <E extends Enum> E reqEnum(String key,
                                  Class<E> enumClass)

optEnum

public <E extends Enum> E optEnum(String key,
                                  Class<E> enumClass)

reqList

public <S extends Resource> List<S> reqList(String key,
                                            Class<S> claz)
Type Parameters:
S - The sub-resource type

optList

public <S> List<S> optList(String key,
                           Class<S> claz)
Type Parameters:
S - The sub-resource type

reqSubResource

public <S extends Resource> S reqSubResource(String key,
                                             Class<S> claz)

optSubResource

public <S extends Resource> S optSubResource(String key,
                                             Class<S> claz)

toJson

public String toJson()

toString

public String toString()
Overrides:
toString in class Object

nullCheck

protected static String nullCheck(String id)

uri

protected static String uri(String... paths)

apiVersionCheck

protected static void apiVersionCheck(org.json.JSONObject jsonObj)


Copyright © 2018 ChargeBee. All Rights Reserved.