public final class Payment extends Object implements FxConvertible<Payment>, org.joda.beans.ImmutableBean, Serializable
This class represents a payment, where the payment date and amount are known. A negative value indicates the amount is to be paid while a positive value indicates the amount is received.
| Modifier and Type | Class and Description |
|---|---|
static class |
Payment.Builder
The bean-builder for
Payment. |
static class |
Payment.Meta
The meta-bean for
Payment. |
| Modifier and Type | Method and Description |
|---|---|
Payment |
adjustDate(TemporalAdjuster adjuster)
Adjusts the payment date using the rules of the specified adjuster.
|
static Payment.Builder |
builder()
Returns a builder used to create an instance of the bean.
|
Payment |
convertedTo(Currency resultCurrency,
FxRateProvider rateProvider)
Converts this payment to an equivalent payment in the specified currency.
|
boolean |
equals(Object obj) |
double |
getAmount()
Gets the amount of the payment.
|
Currency |
getCurrency()
Gets the currency of the payment.
|
LocalDate |
getDate()
Gets the date that the payment is made.
|
CurrencyAmount |
getValue()
Gets the amount of the payment.
|
int |
hashCode() |
static Payment.Meta |
meta()
The meta-bean for
Payment. |
Payment.Meta |
metaBean() |
Payment |
negated()
Returns a copy of this
Payment with the value negated. |
static Payment |
of(CurrencyAmount value,
LocalDate date)
Obtains an instance representing an amount.
|
static Payment |
of(Currency currency,
double amount,
LocalDate date)
Obtains an instance representing an amount.
|
static Payment |
ofPay(CurrencyAmount value,
LocalDate date)
Obtains an instance representing an amount to be paid.
|
static Payment |
ofReceive(CurrencyAmount value,
LocalDate date)
Obtains an instance representing an amount to be received.
|
Payment.Builder |
toBuilder()
Returns a builder that allows this bean to be mutated.
|
String |
toString() |
public static Payment of(Currency currency, double amount, LocalDate date)
Whether the payment is pay or receive is determined by the sign of the specified amount.
currency - the currency of the paymentamount - the amount of the paymentdate - the date that the payment is madepublic static Payment of(CurrencyAmount value, LocalDate date)
Whether the payment is pay or receive is determined by the sign of the specified amount.
value - the amount of the paymentdate - the date that the payment is madepublic static Payment ofPay(CurrencyAmount value, LocalDate date)
The sign of the amount will be normalized to be negative, indicating a payment.
value - the amount of the paymentdate - the date that the payment is madepublic static Payment ofReceive(CurrencyAmount value, LocalDate date)
The sign of the amount will be normalized to be positive, indicating receipt.
value - the amount of the paymentdate - the date that the payment is madepublic Currency getCurrency()
This simply returns getValue().getCurrency().
public double getAmount()
The payment value is signed. A negative value indicates a payment while a positive value indicates receipt.
This simply returns getValue().getAmount().
public Payment adjustDate(TemporalAdjuster adjuster)
The adjuster is typically an instance of BusinessDayAdjustment.
If the date is unchanged by the adjuster, this payment will be returned.
adjuster - the adjuster to apply to the payment datepublic Payment negated()
Payment with the value negated.
This takes this payment and negates it.
This instance is immutable and unaffected by this method.
public Payment convertedTo(Currency resultCurrency, FxRateProvider rateProvider)
The result will be expressed in terms of the given currency. If conversion is needed, the provider will be used to supply the FX rate.
convertedTo in interface FxConvertible<Payment>resultCurrency - the currency of the resultrateProvider - the provider of FX ratesRuntimeException - if no FX rate could be foundpublic static Payment.Meta meta()
Payment.public static Payment.Builder builder()
public Payment.Meta metaBean()
metaBean in interface org.joda.beans.Beanpublic CurrencyAmount getValue()
The amount is signed. A negative value indicates the amount is to be paid while a positive value indicates the amount is received.
public LocalDate getDate()
This date should normally be a valid business day.
public Payment.Builder toBuilder()
Copyright 2009-Present by OpenGamma Inc. and individual contributors
Apache v2 licensed
Additional documentation can be found at strata.opengamma.io.