Class SummarizerUtils


  • public final class SummarizerUtils
    extends Object
    Utilities to support summarizing portfolio items.

    This class provides a central place for description logic.

    • Method Detail

      • date

        public static String date​(LocalDate date)
        Converts a date to a string.
        Parameters:
        date - the date
        Returns:
        the string form
      • dateRange

        public static String dateRange​(LocalDate start,
                                       LocalDate end)
        Converts a date range to a string.
        Parameters:
        start - the start date
        end - the end date
        Returns:
        the string form
      • datePeriod

        public static String datePeriod​(LocalDate start,
                                        LocalDate end)
        Converts a date range to a period string.
        Parameters:
        start - the start date
        end - the end date
        Returns:
        the string form
      • amount

        public static String amount​(CurrencyAmount currencyAmount)
        Converts an amount to a string.
        Parameters:
        currencyAmount - the amount
        Returns:
        the string form
      • amount

        public static String amount​(Currency currency,
                                    double value)
        Converts an amount to a string.
        Parameters:
        currency - the currency
        value - the value
        Returns:
        the string form
      • value

        public static String value​(double value)
        Converts a value to a string.
        Parameters:
        value - the value
        Returns:
        the string form
      • percent

        public static String percent​(double decimalForm)
        Converts a value to a percentage string.
        Parameters:
        decimalForm - the value in decimal form
        Returns:
        the string form
      • payReceive

        public static String payReceive​(PayReceive payReceive)
        Converts pay/receive to a string.
        Parameters:
        payReceive - the value
        Returns:
        the string form
      • fx

        public static String fx​(CurrencyAmount base,
                                CurrencyAmount counter)
        Converts an FX exchange to a string.
        Parameters:
        base - the base currency amount
        counter - the counter currency amount
        Returns:
        the string form
      • summary

        public static PortfolioItemSummary summary​(Position position,
                                                   ProductType type,
                                                   String description,
                                                   Currency... currencies)
        Creates a summary instance for a position.
        Parameters:
        position - the position
        type - the type
        description - the description
        currencies - the currencies, may be empty
        Returns:
        the string form
      • summary

        public static PortfolioItemSummary summary​(Trade trade,
                                                   ProductType type,
                                                   String description,
                                                   Currency... currencies)
        Creates a summary instance for a trade.
        Parameters:
        trade - the trade
        type - the type
        description - the description
        currencies - the currencies, may be empty
        Returns:
        the string form