Class CashFlows
- java.lang.Object
-
- com.opengamma.strata.market.amount.CashFlows
-
- All Implemented Interfaces:
FxConvertible<CashFlows>,Serializable,org.joda.beans.Bean,org.joda.beans.ImmutableBean
public final class CashFlows extends Object implements FxConvertible<CashFlows>, org.joda.beans.ImmutableBean, Serializable
A collection of cash flows.Contains a list of cash flow objects, each referring to a single cash flow. The list is can be sorted by date and value if desired.
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCashFlows.MetaThe meta-bean forCashFlows.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description CashFlowscombinedWith(CashFlow cashFlow)Combines this cash flows instance with another cash flow.CashFlowscombinedWith(CashFlows other)Combines this cash flows instance with another one.CashFlowsconvertedTo(Currency resultCurrency, FxRateProvider rateProvider)Converts this collection of cash flows to an equivalent amount in the specified currency.booleanequals(Object obj)CashFlowgetCashFlow(int index)Gets the cash flow by index.ImmutableList<CashFlow>getCashFlows()Gets the cash flows.inthashCode()static CashFlows.Metameta()The meta-bean forCashFlows.CashFlows.MetametaBean()static CashFlowsof(CashFlow cashFlow)Obtains an instance from a single cash flow.static CashFlowsof(List<CashFlow> cashFlows)Obtains an instance from a list of cash flows.CashFlowssorted()Returns an instance that is sorted.StringtoString()
-
-
-
Field Detail
-
NONE
public static final CashFlows NONE
A cash flows instance to be used when there is no cash flow.
-
-
Method Detail
-
of
public static CashFlows of(CashFlow cashFlow)
Obtains an instance from a single cash flow.- Parameters:
cashFlow- The cash flow- Returns:
- the cash flows instance
-
of
public static CashFlows of(List<CashFlow> cashFlows)
Obtains an instance from a list of cash flows.- Parameters:
cashFlows- the list of cash flows- Returns:
- the cash flows instance
-
getCashFlow
public CashFlow getCashFlow(int index)
Gets the cash flow by index.- Parameters:
index- the index to get- Returns:
- the cash flow
-
combinedWith
public CashFlows combinedWith(CashFlow cashFlow)
Combines this cash flows instance with another cash flow.This returns a new cash flows instance with a combined list of cash flow instances. This instance is immutable and unaffected by this method. The result may contain duplicate cash flows.
- Parameters:
cashFlow- the additional single cash flow- Returns:
- the new instance of
CashFlowsbased on this instance, with the additional single cash flow added
-
combinedWith
public CashFlows combinedWith(CashFlows other)
Combines this cash flows instance with another one.This returns a new cash flows instance with a combined list of cash flow instances. This instance is immutable and unaffected by this method. The result may contain duplicate cash flows.
- Parameters:
other- the other cash flows- Returns:
- the new instance of
CashFlowsbased on this instance, with the other instance added
-
sorted
public CashFlows sorted()
Returns an instance that is sorted.The sort is by date, then value.
- Returns:
- the sorted instance
-
convertedTo
public CashFlows convertedTo(Currency resultCurrency, FxRateProvider rateProvider)
Converts this collection of cash flows to an equivalent amount in the specified currency.This ensures that the result will have all currency amounts expressed in terms of the given currency. If conversion is needed, the provider will be used to supply the FX rate.
- Specified by:
convertedToin interfaceFxConvertible<CashFlows>- Parameters:
resultCurrency- the currency of the resultrateProvider- the provider of FX rates- Returns:
- the converted instance, in the specified currency
- Throws:
RuntimeException- if no FX rate could be found
-
meta
public static CashFlows.Meta meta()
The meta-bean forCashFlows.- Returns:
- the meta-bean, not null
-
metaBean
public CashFlows.Meta metaBean()
- Specified by:
metaBeanin interfaceorg.joda.beans.Bean
-
getCashFlows
public ImmutableList<CashFlow> getCashFlows()
Gets the cash flows.Each entry includes details of a single cash flow.
- Returns:
- the value of the property, not null
-
-