public interface PortfolioItemInfo extends Attributes
This allows additional information to be associated with an item. It is kept in a separate object as the information is generally optional for pricing.
Implementations of this interface must be immutable beans.
| Modifier and Type | Method and Description |
|---|---|
static PortfolioItemInfoBuilder<PortfolioItemInfo> |
builder()
Returns a builder used to create an instance of the bean.
|
default PortfolioItemInfo |
combinedWith(PortfolioItemInfo other)
Combines this info with another.
|
static PortfolioItemInfo |
empty()
Obtains an empty info instance.
|
ImmutableSet<AttributeType<?>> |
getAttributeTypes()
Gets the attribute types that are available.
|
Optional<StandardId> |
getId()
Gets the primary identifier for the portfolio item, optional.
|
static <T> PortfolioItemInfo |
of(AttributeType<T> type,
T value)
Obtains an instance with a single attribute.
|
default PortfolioItemInfo |
overrideWith(PortfolioItemInfo other)
Overrides attributes of this info with another.
|
<T> PortfolioItemInfo |
withAttribute(AttributeType<T> type,
T value)
Returns a copy of this instance with the attribute added.
|
default PortfolioItemInfo |
withAttributes(Attributes other)
Returns a copy of this instance with the attributes added.
|
PortfolioItemInfo |
withId(StandardId identifier)
Returns a copy of this instance with the identifier changed.
|
containsAttribute, containsAttribute, findAttribute, getAttributestatic PortfolioItemInfo empty()
The resulting instance implements this interface and is useful for classes that
extend PortfolioItem but are not trades or positions.
The returned instance can be customized using with methods.
empty in interface Attributesstatic <T> PortfolioItemInfo of(AttributeType<T> type, T value)
The withAttribute(AttributeType, Object) method can be used on
the instance to add more attributes.
of in interface AttributesT - the type of the attribute valuetype - the type providing meaning to the valuevalue - the valuestatic PortfolioItemInfoBuilder<PortfolioItemInfo> builder()
Optional<StandardId> getId()
The identifier is used to identify the portfolio item. It will typically be an identifier in an external data system.
A portfolio item may have multiple active identifiers. Any identifier may be chosen here. Certain uses of the identifier, such as storage in a database, require that the identifier does not change over time, and this should be considered best practice.
PortfolioItemInfo withId(StandardId identifier)
This returns a new instance with the identifier changed. If the specified identifier is null, the existing identifier will be removed. If the specified identifier is non-null, it will become the identifier of the resulting info.
identifier - the identifier to setImmutableSet<AttributeType<?>> getAttributeTypes()
Attributes
See AttributeType.captureWildcard() for a way to capture the wildcard type.
The default implementation returns an empty set (backwards compatibility prevents an abstract method for now).
getAttributeTypes in interface Attributes<T> PortfolioItemInfo withAttribute(AttributeType<T> type, T value)
Attributes
This returns a new instance with the specified attribute added.
The attribute is added using Map.put(type, value) semantics.
withAttribute in interface AttributesT - the type of the attribute valuetype - the type providing meaning to the valuevalue - the valuedefault PortfolioItemInfo withAttributes(Attributes other)
Attributes
This returns a new instance with the specified attributes added.
The attributes are added using Map.putAll(type, value) semantics.
withAttributes in interface Attributesother - the other instance to copy fromdefault PortfolioItemInfo combinedWith(PortfolioItemInfo other)
If there is a conflict, data from this instance takes precedence. If the other instance is not of the same type, data may be lost.
other - the other instancedefault PortfolioItemInfo overrideWith(PortfolioItemInfo other)
If there is a conflict, data from the other instance takes precedence. If the other instance is not of the same type, data may be lost.
other - the other instanceCopyright 2009-Present by OpenGamma Inc. and individual contributors
Apache v2 licensed
Additional documentation can be found at strata.opengamma.io.