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 boolean
equals(Object obj)
Checks if this identifier equals another identifier.EtdContractGroupCode
getCode()
Gets the contract group code, as defined by the exchange.ExchangeId
getExchangeId()
Gets the exchange identifier.int
hashCode()
Returns a suitable hash code for the identifier.static EtdContractGroupId
of(ExchangeId exchangeId, EtdContractGroupCode contractGroupCode)
Creates an instance from the exchange identifier and group code.static EtdContractGroupId
of(String exchangeId, String contractGroupCode)
Obtains an instance from the exchange identifier and group code.static EtdContractGroupId
parse(String str)
Parses anStandardId
from a formatted scheme and value.String
toString()
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 anStandardId
from 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)
.
-
-