Class 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 Detail

      • of

        public static EtdContractGroupId of​(String exchangeId,
                                            String contractGroupCode)
        Obtains an instance from the exchange identifier and group code.
        Parameters:
        exchangeId - the exchange identifier
        contractGroupCode - 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 identifier
        contractGroupCode - the code defined by the exchange
        Returns:
        the identifier
      • parse

        public static EtdContractGroupId parse​(String str)
        Parses an StandardId 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.

        Overrides:
        equals in class Object
        Parameters:
        obj - the other identifier, null returns false
        Returns:
        true if equal
      • hashCode

        public int hashCode()
        Returns a suitable hash code for the identifier.
        Overrides:
        hashCode in class Object
        Returns:
        the hash code
      • 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 with parse(String).

        Overrides:
        toString in class Object
        Returns:
        a parsable representation of the identifier