Class SecurityInfo
- java.lang.Object
-
- com.opengamma.strata.product.SecurityInfo
-
- All Implemented Interfaces:
Attributes
,Serializable
,org.joda.beans.Bean
,org.joda.beans.ImmutableBean
public final class SecurityInfo extends Object implements Attributes, org.joda.beans.ImmutableBean, Serializable
Information about a security.This provides common information about a security. This includes the identifier, information about the price and an extensible data map.
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SecurityInfo.Meta
The meta-bean forSecurityInfo
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SecurityInfoBuilder
builder()
Returns a builder used to create an instance of the bean.boolean
equals(Object obj)
<T> Optional<T>
findAttribute(AttributeType<T> type)
Finds the attribute associated with the specified type.ImmutableMap<AttributeType<?>,Object>
getAttributes()
Gets the security attributes.ImmutableSet<AttributeType<?>>
getAttributeTypes()
Gets the attribute types that are available.SecurityId
getId()
Gets the security identifier.SecurityPriceInfo
getPriceInfo()
Gets the information about the security price.int
hashCode()
static SecurityInfo.Meta
meta()
The meta-bean forSecurityInfo
.SecurityInfo.Meta
metaBean()
static SecurityInfo
of(SecurityId id, double tickSize, CurrencyAmount tickValue)
Obtains an instance from the identifier, tick size and tick value.static SecurityInfo
of(SecurityId id, SecurityPriceInfo priceInfo)
Obtains an instance from the identifier and pricing info.SecurityInfoBuilder
toBuilder()
Returns a builder populated with the values of this instance.String
toString()
<T> SecurityInfo
withAttribute(AttributeType<T> type, T value)
Returns a copy of this instance with the attribute added.SecurityInfo
withAttributes(Attributes other)
Returns a copy of this instance with the attributes added.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.opengamma.strata.product.Attributes
containsAttribute, containsAttribute, getAttribute
-
-
-
-
Method Detail
-
of
public static SecurityInfo of(SecurityId id, double tickSize, CurrencyAmount tickValue)
Obtains an instance from the identifier, tick size and tick value.This creates an instance, building the
SecurityPriceInfo
from the tick size and tick value, setting the contract size to 1.A
SecurityInfo
also contains a hash map of additional information, keyed byAttributeType
. This hash map may contain anything of interest, and is populated usingwithAttribute(AttributeType, Object)
.- Parameters:
id
- the security identifiertickSize
- the size of each tick, not negative or zerotickValue
- the value of each tick- Returns:
- the security information
-
of
public static SecurityInfo of(SecurityId id, SecurityPriceInfo priceInfo)
Obtains an instance from the identifier and pricing info.A
SecurityInfo
also contains a hash map of additional information, keyed byAttributeType
. This hash map may contain anything of interest, and is populated usingwithAttribute(AttributeType, Object)
.- Parameters:
id
- the security identifierpriceInfo
- the information about the price- Returns:
- the security information
-
builder
public static SecurityInfoBuilder builder()
Returns a builder used to create an instance of the bean.- Returns:
- the builder, not null
-
getAttributeTypes
public ImmutableSet<AttributeType<?>> getAttributeTypes()
Description copied from interface:Attributes
Gets the attribute types that are available.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).
- Specified by:
getAttributeTypes
in interfaceAttributes
- Returns:
- the attribute types
-
findAttribute
public <T> Optional<T> findAttribute(AttributeType<T> type)
Description copied from interface:Attributes
Finds the attribute associated with the specified type.This method obtains the specified attribute. This allows an attribute to be obtained if available.
If the attribute is not found, optional empty is returned.
- Specified by:
findAttribute
in interfaceAttributes
- Type Parameters:
T
- the type of the result- Parameters:
type
- the type to find- Returns:
- the attribute value
-
withAttribute
public <T> SecurityInfo 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 interfaceAttributes
- Type Parameters:
T
- the type of the attribute value- Parameters:
type
- the type providing meaning to the valuevalue
- the value- Returns:
- a new instance based on this one with the attribute added
-
withAttributes
public SecurityInfo withAttributes(Attributes other)
Description copied from interface:Attributes
Returns a copy of this instance with the attributes added.This returns a new instance with the specified attributes added. The attributes are added using
Map.putAll(type, value)
semantics.- Specified by:
withAttributes
in interfaceAttributes
- Parameters:
other
- the other instance to copy from- Returns:
- an instance based on this one with the attributes from the other instance
-
toBuilder
public SecurityInfoBuilder toBuilder()
Returns a builder populated with the values of this instance.- Returns:
- a builder populated with the values of this instance
-
meta
public static SecurityInfo.Meta meta()
The meta-bean forSecurityInfo
.- Returns:
- the meta-bean, not null
-
metaBean
public SecurityInfo.Meta metaBean()
- Specified by:
metaBean
in interfaceorg.joda.beans.Bean
-
getId
public SecurityId getId()
Gets the security identifier.This identifier uniquely identifies the security within the system. It is the key used to lookup the security in
ReferenceData
.A real-world security will typically have multiple identifiers. The only restriction placed on the identifier is that it is sufficiently unique for the reference data lookup. As such, it is acceptable to use an identifier from a well-known global or vendor symbology.
- Returns:
- the value of the property, not null
-
getPriceInfo
public SecurityPriceInfo getPriceInfo()
Gets the information about the security price.This provides information about the security price. This can be used to convert the price into a monetary value.
- Returns:
- the value of the property, not null
-
getAttributes
public ImmutableMap<AttributeType<?>,Object> getAttributes()
Gets the security attributes.Security attributes provide the ability to associate arbitrary information in a key-value map.
- Returns:
- the value of the property, not null
-
-