Class SummarizerUtils
- java.lang.Object
-
- com.opengamma.strata.product.common.SummarizerUtils
-
public final class SummarizerUtils extends 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 String
amount(CurrencyAmount currencyAmount)
Converts an amount to a string.static String
amount(Currency currency, double value)
Converts an amount to a string.static String
date(LocalDate date)
Converts a date to a string.static String
datePeriod(LocalDate start, LocalDate end)
Converts a date range to a period string.static String
dateRange(LocalDate start, LocalDate end)
Converts a date range to a string.static String
fx(CurrencyAmount base, CurrencyAmount counter)
Converts an FX exchange to a string.static String
payReceive(PayReceive payReceive)
Converts pay/receive to a string.static String
percent(double decimalForm)
Converts a value to a percentage string.static PortfolioItemSummary
summary(Position position, ProductType type, String description, Currency... currencies)
Creates a summary instance for a position.static PortfolioItemSummary
summary(Trade trade, ProductType type, String description, Currency... currencies)
Creates a summary instance for a trade.static String
value(double value)
Converts a value to a string.
-
-
-
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 dateend
- 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 dateend
- 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 currencyvalue
- 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 amountcounter
- 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 positiontype
- the typedescription
- the descriptioncurrencies
- 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 tradetype
- the typedescription
- the descriptioncurrencies
- the currencies, may be empty- Returns:
- the string form
-
-