Interface PortfolioItemInfo

  • All Superinterfaces:
    All Known Implementing Classes:
    PositionInfo, TradeInfo

    public interface PortfolioItemInfo
    extends Attributes
    Additional information about a portfolio item.

    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.

    • Method Detail

      • empty

        static PortfolioItemInfo empty()
        Obtains an empty info instance.

        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.

        the empty info instance
      • getId

        java.util.Optional<StandardId> getId()
        Gets the primary identifier for the portfolio item, optional.

        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.

        the identifier, optional
      • withId

        PortfolioItemInfo withId​(StandardId identifier)
        Returns a copy of this instance with the identifier changed.

        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 set
        a new instance based on this one with the identifier set
      • getAttributeTypes<AttributeType<?>> getAttributeTypes()
        Gets the attribute types that the info contains.
        the attribute types
      • withAttribute

        <T> PortfolioItemInfo withAttribute​(AttributeType<T> type,
                                            T value)
        Description copied from interface: Attributes
        Returns a copy of this instance with the attribute added.

        This returns a new instance with the specified attribute added. The attribute is added using Map.put(type, value) semantics.

        Specified by:
        withAttribute in interface Attributes
        Type Parameters:
        T - the type of the attribute value
        type - the type providing meaning to the value
        value - the value
        a new instance based on this one with the attribute added