public class Discount extends GenericParcelable implements Validator, JSONifiable
IOrderService
Modifier and Type | Class and Description |
---|---|
static interface |
Discount.Constraints |
JSONifiable.Creator<T>
Parcelable.ClassLoaderCreator<T>, Parcelable.Creator<T>
Modifier and Type | Field and Description |
---|---|
static Parcelable.Creator<Discount> |
CREATOR |
static JSONifiable.Creator<Discount> |
JSON_CREATOR |
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE
Modifier | Constructor and Description |
---|---|
|
Discount()
Constructs a new empty instance.
|
protected |
Discount(boolean noInit)
Constructs a new empty instance.
|
|
Discount(Discount src)
Constructs a new instance that is a deep copy of the source instance.
|
|
Discount(JSONObject jsonObject)
Construct a new instance backed by the given JSONObject, the parameter is not copied so changes to it will be
reflected in this instance and vice-versa.
|
|
Discount(String json)
Constructs a new instance from the given JSON String.
|
Modifier and Type | Method and Description |
---|---|
void |
clearAmount()
Clears the 'amount' field, the 'has' method for this field will now return false
|
void |
clearApprover()
Clears the 'approver' field, the 'has' method for this field will now return false
|
void |
clearDiscount()
Clears the 'discount' field, the 'has' method for this field will now return false
|
void |
clearId()
Clears the 'id' field, the 'has' method for this field will now return false
|
void |
clearName()
Clears the 'name' field, the 'has' method for this field will now return false
|
void |
clearPercentage()
Clears the 'percentage' field, the 'has' method for this field will now return false
|
boolean |
containsChanges()
Returns true if this instance has any changes.
|
Discount |
copyChanges()
Create a copy of this instance that contains only fields that were set after the constructor was called.
|
Long |
getAmount()
Discount amount in fraction of currency unit (e.g.
|
Reference |
getApprover()
The person that authorized a discount
|
Reference |
getDiscount()
If this item is based on a standard discount, this will point to the appropriate inventory.Discount
|
protected GenericClient |
getGenericClient() |
String |
getId()
Unique identifier
|
JSONObject |
getJSONObject()
Returns the internal JSONObject backing this instance, the return value is not a copy so changes to it will be
reflected in this instance and vice-versa.
|
String |
getName()
Name of the discount
|
Long |
getPercentage()
Discount amount in percent
|
boolean |
hasAmount()
Checks whether the 'amount' field has been set, however the value could be null
|
boolean |
hasApprover()
Checks whether the 'approver' field has been set, however the value could be null
|
boolean |
hasDiscount()
Checks whether the 'discount' field has been set, however the value could be null
|
boolean |
hasId()
Checks whether the 'id' field has been set, however the value could be null
|
boolean |
hasName()
Checks whether the 'name' field has been set, however the value could be null
|
boolean |
hasPercentage()
Checks whether the 'percentage' field has been set, however the value could be null
|
boolean |
isNotNullAmount()
Checks whether the 'amount' field is set and is not null
|
boolean |
isNotNullApprover()
Checks whether the 'approver' field is set and is not null
|
boolean |
isNotNullDiscount()
Checks whether the 'discount' field is set and is not null
|
boolean |
isNotNullId()
Checks whether the 'id' field is set and is not null
|
boolean |
isNotNullName()
Checks whether the 'name' field is set and is not null
|
boolean |
isNotNullPercentage()
Checks whether the 'percentage' field is set and is not null
|
void |
mergeChanges(Discount src)
Copy all the changed fields from the given source to this instance.
|
void |
resetChangeLog()
Reset the log of changes made to this instance, calling copyChanges() after this would return an empty instance.
|
Discount |
setAmount(Long amount)
Sets the field 'amount'.
|
Discount |
setApprover(Reference approver)
Sets the field 'approver'.
|
Discount |
setDiscount(Reference discount)
Sets the field 'discount'.
|
Discount |
setId(String id)
Sets the field 'id'.
|
Discount |
setName(String name)
Sets the field 'name'.
|
Discount |
setPercentage(Long percentage)
Sets the field 'percentage'.
|
void |
validate() |
describeContents, getBundle, toString, writeToParcel
public static final Parcelable.Creator<Discount> CREATOR
public static final JSONifiable.Creator<Discount> JSON_CREATOR
public Discount()
protected Discount(boolean noInit)
public Discount(String json) throws IllegalArgumentException
IllegalArgumentException
public Discount(JSONObject jsonObject)
public Discount(Discount src)
public String getId()
public Reference getDiscount()
public Reference getApprover()
public String getName()
public Long getAmount()
public Long getPercentage()
protected GenericClient getGenericClient()
getGenericClient
in class GenericParcelable
public JSONObject getJSONObject()
getJSONObject
in interface JSONifiable
public boolean isNotNullId()
public boolean isNotNullDiscount()
public boolean isNotNullApprover()
public boolean isNotNullName()
public boolean isNotNullAmount()
public boolean isNotNullPercentage()
public boolean hasId()
public boolean hasDiscount()
public boolean hasApprover()
public boolean hasName()
public boolean hasAmount()
public boolean hasPercentage()
public Discount setDiscount(Reference discount)
public Discount setApprover(Reference approver)
public void clearId()
public void clearDiscount()
public void clearApprover()
public void clearName()
public void clearAmount()
public void clearPercentage()
public boolean containsChanges()
public void resetChangeLog()
public Discount copyChanges()
public void mergeChanges(Discount src)