Class AdjustablePayment

  • All Implemented Interfaces:
    Resolvable<Payment>, Serializable, org.joda.beans.Bean, org.joda.beans.ImmutableBean

    public final class AdjustablePayment
    extends Object
    implements Resolvable<Payment>, org.joda.beans.ImmutableBean, Serializable
    A single payment of a known amount on a date, with business day adjustment rules.

    This class represents a payment, where the payment date and amount are known. The date is specified using an AdjustableDate which allows holidays and weekends to be handled. A negative value indicates the amount is to be paid while a positive value indicates the amount is received.

    See Also:
    Serialized Form
    • Method Detail

      • of

        public static AdjustablePayment of​(Currency currency,
                                           double amount,
                                           LocalDate date)
        Obtains an instance representing an amount where the date is fixed.

        Whether the payment is pay or receive is determined by the sign of the specified amount.

        Parameters:
        currency - the currency of the payment
        amount - the amount of the payment
        date - the date that the payment is made
        Returns:
        the adjustable payment instance
      • of

        public static AdjustablePayment of​(Currency currency,
                                           double amount,
                                           AdjustableDate date)
        Obtains an instance representing an amount where the date is adjustable.

        Whether the payment is pay or receive is determined by the sign of the specified amount.

        Parameters:
        currency - the currency of the payment
        amount - the amount of the payment
        date - the date that the payment is made
        Returns:
        the adjustable payment instance
      • of

        public static AdjustablePayment of​(CurrencyAmount value,
                                           LocalDate date)
        Obtains an instance representing an amount where the date is fixed.

        Whether the payment is pay or receive is determined by the sign of the specified amount.

        Parameters:
        value - the amount of the payment
        date - the date that the payment is made
        Returns:
        the adjustable payment instance
      • of

        public static AdjustablePayment of​(CurrencyAmount value,
                                           AdjustableDate date)
        Obtains an instance representing an amount where the date is adjustable.

        Whether the payment is pay or receive is determined by the sign of the specified amount.

        Parameters:
        value - the amount of the payment
        date - the date that the payment is made
        Returns:
        the adjustable payment instance
      • ofPay

        public static AdjustablePayment ofPay​(CurrencyAmount value,
                                              LocalDate date)
        Obtains an instance representing an amount to be paid where the date is fixed.

        The sign of the amount will be normalized to be negative, indicating a payment.

        Parameters:
        value - the amount of the payment
        date - the date that the payment is made
        Returns:
        the adjustable payment instance
      • ofPay

        public static AdjustablePayment ofPay​(CurrencyAmount value,
                                              AdjustableDate date)
        Obtains an instance representing an amount to be paid where the date is adjustable.

        The sign of the amount will be normalized to be negative, indicating a payment.

        Parameters:
        value - the amount of the payment
        date - the date that the payment is made
        Returns:
        the adjustable payment instance
      • ofReceive

        public static AdjustablePayment ofReceive​(CurrencyAmount value,
                                                  LocalDate date)
        Obtains an instance representing an amount to be received where the date is fixed.

        The sign of the amount will be normalized to be positive, indicating receipt.

        Parameters:
        value - the amount of the payment
        date - the date that the payment is made
        Returns:
        the adjustable payment instance
      • ofReceive

        public static AdjustablePayment ofReceive​(CurrencyAmount value,
                                                  AdjustableDate date)
        Obtains an instance representing an amount to be received where the date is adjustable.

        The sign of the amount will be normalized to be positive, indicating receipt.

        Parameters:
        value - the amount of the payment
        date - the date that the payment is made
        Returns:
        the adjustable payment instance
      • of

        public static AdjustablePayment of​(Payment payment)
        Obtains an instance based on a Payment.
        Parameters:
        payment - the fixed payment
        Returns:
        the adjustable payment instance
      • getCurrency

        public Currency getCurrency()
        Gets the currency of the payment.

        This simply returns getValue().getCurrency().

        Returns:
        the currency of the payment
      • getAmount

        public double getAmount()
        Gets the amount of the payment.

        The payment value is signed. A negative value indicates a payment while a positive value indicates receipt.

        This simply returns getValue().getAmount().

        Returns:
        the amount of the payment
      • resolve

        public Payment resolve​(ReferenceData refData)
        Resolves the date on this payment, returning a payment with a fixed date.

        This returns a Payment with the same amount and resolved date.

        Specified by:
        resolve in interface Resolvable<Payment>
        Parameters:
        refData - the reference data, used to find the holiday calendar
        Returns:
        the resolved payment
      • negated

        public AdjustablePayment negated()
        Returns a copy of this payment with the value negated.

        This takes this payment and negates it.

        This instance is immutable and unaffected by this method.

        Returns:
        a payment based on this with the value negated
      • meta

        public static AdjustablePayment.Meta meta()
        The meta-bean for AdjustablePayment.
        Returns:
        the meta-bean, not null
      • metaBean

        public AdjustablePayment.Meta metaBean()
        Specified by:
        metaBean in interface org.joda.beans.Bean
      • getValue

        public CurrencyAmount getValue()
        Gets the amount of the payment.

        The amount is signed. A negative value indicates the amount is to be paid while a positive value indicates the amount is received.

        Returns:
        the value of the property, not null
      • getDate

        public AdjustableDate getDate()
        Gets the date that the payment is made.

        This date should normally be a valid business day.

        Returns:
        the value of the property, not null
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object