Class SummarizerUtils


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

    This class provides a central place for description logic.

    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String amount​(CurrencyAmount currencyAmount)
      Converts an amount to a string.
      static java.lang.String amount​(Currency currency, double value)
      Converts an amount to a string.
      static java.lang.String date​(java.time.LocalDate date)
      Converts a date to a string.
      static java.lang.String datePeriod​(java.time.LocalDate start, java.time.LocalDate end)
      Converts a date range to a period string.
      static java.lang.String dateRange​(java.time.LocalDate start, java.time.LocalDate end)
      Converts a date range to a string.
      static java.lang.String fx​(CurrencyAmount base, CurrencyAmount counter)
      Converts an FX exchange to a string.
      static java.lang.String payReceive​(PayReceive payReceive)
      Converts pay/receive to a string.
      static java.lang.String percent​(double value)
      Converts a value to a percentage string.
      static PortfolioItemSummary summary​(Position position, ProductType type, java.lang.String description, Currency... currencies)
      Creates a summary instance for a position.
      static PortfolioItemSummary summary​(Trade trade, ProductType type, java.lang.String description, Currency... currencies)
      Creates a summary instance for a trade.
      static java.lang.String value​(double value)
      Converts a value to a string.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • date

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

        public static java.lang.String dateRange​(java.time.LocalDate start,
                                                 java.time.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 java.lang.String datePeriod​(java.time.LocalDate start,
                                                  java.time.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 java.lang.String amount​(CurrencyAmount currencyAmount)
        Converts an amount to a string.
        Parameters:
        currencyAmount - the amount
        Returns:
        the string form
      • amount

        public static java.lang.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 java.lang.String value​(double value)
        Converts a value to a string.
        Parameters:
        value - the value
        Returns:
        the string form
      • percent

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

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

        public static java.lang.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,
                                                   java.lang.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,
                                                   java.lang.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