Package com.opengamma.strata.product.etd
Class EtdContractGroupId
- java.lang.Object
-
- com.opengamma.strata.product.etd.EtdContractGroupId
-
- All Implemented Interfaces:
Serializable
public final class EtdContractGroupId extends Object implements Serializable
An identifier for a group of ETD contracts.This is used to group similar ETD contracts together for the purpose of allocating risk.
The identifier is formed of two parts, the exchange and the code defined by the exchange.
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object obj)Checks if this identifier equals another identifier.EtdContractGroupCodegetCode()Gets the contract group code, as defined by the exchange.ExchangeIdgetExchangeId()Gets the exchange identifier.inthashCode()Returns a suitable hash code for the identifier.static EtdContractGroupIdof(ExchangeId exchangeId, EtdContractGroupCode contractGroupCode)Creates an instance from the exchange identifier and group code.static EtdContractGroupIdof(String exchangeId, String contractGroupCode)Obtains an instance from the exchange identifier and group code.static EtdContractGroupIdparse(String str)Parses anStandardIdfrom a formatted scheme and value.StringtoString()Returns the identifier in a standard string format.
-
-
-
Method Detail
-
of
public static EtdContractGroupId of(String exchangeId, String contractGroupCode)
Obtains an instance from the exchange identifier and group code.- Parameters:
exchangeId- the exchange identifiercontractGroupCode- the code defined by the exchange- Returns:
- the identifier
- Throws:
IllegalArgumentException- if either value is invalid
-
of
public static EtdContractGroupId of(ExchangeId exchangeId, EtdContractGroupCode contractGroupCode)
Creates an instance from the exchange identifier and group code.- Parameters:
exchangeId- the exchange identifiercontractGroupCode- the code defined by the exchange- Returns:
- the identifier
-
parse
public static EtdContractGroupId parse(String str)
Parses anStandardIdfrom a formatted scheme and value.This parses the identifier from the form produced by
toString()which is '$exchange::$code'.- Parameters:
str- the identifier to parse- Returns:
- the identifier
- Throws:
IllegalArgumentException- if the identifier cannot be parsed
-
getExchangeId
public ExchangeId getExchangeId()
Gets the exchange identifier.- Returns:
- the exchange identifier
-
getCode
public EtdContractGroupCode getCode()
Gets the contract group code, as defined by the exchange.- Returns:
- the group code
-
equals
public boolean equals(Object obj)
Checks if this identifier equals another identifier.The comparison checks the name.
-
hashCode
public int hashCode()
Returns a suitable hash code for the identifier.
-
toString
public String toString()
Returns the identifier in a standard string format.The returned string is in the form '
$exchange::$code'. This is suitable for use withparse(String).
-
-