Class LegType

  • All Implemented Interfaces:
    DataObject, FastSerializable, Serializable

    public final class LegType
    extends AbstractLazyEncodedNamedInteger<LegType.EncodedValue>
    implements FastSerializable
    Class LegType identifies a specific party in a call. For all operations containing a LegType:
    • LegType = 1 shall always refer to the calling party, more specifically that party in the call present when InitialDP is sent to the SCF.
    • LegType = 2 shall always refer to a called party, more specifically a party in the call created as a result of the InitialDP operation, followed by the Connect, Continue, ContinueWithArgument operation.
    • LegType > 2 shall always refer to a called party, more specifically a party in the call created as a result of the InitiateCallAttempt operation, followed by the ContinueWithArgument operation.
    It represents the ASN.1 OCTET STRING types Core-INAP-CS1-DataTypes.LegType and CAP-datatypes.Legtype.

    The API offered by this class is as if the type were specified in ASN.1 as follows.

     LegType ::= SEQUENCE {
         encodedValue EncodedValue
     }

    EncodedValue is a NamedInteger. For each named value of the type, n, the API defines three Java static fields: a DataObject n, a NamedInteger EncodedValue.n, and an int EncodedValue._n.

    See Also:
    Serialized Form
    • Field Detail

      • CALLING_PARTY

        public static final LegType CALLING_PARTY
        Constant for calling party.
      • CALLED_PARTY

        public static final LegType CALLED_PARTY
        Constant for called party.
    • Constructor Detail

      • LegType

        public LegType()
        Constructs a new LegType object with no fields set.
      • LegType

        public LegType​(byte[] data)
        Constructs a new LegType object from network-encoded data. The data is not decoded and might not be decodable.
        Parameters:
        data - network-encoded data
        Throws:
        NullPointerException - if data is null
      • LegType

        public LegType​(byte[] data,
                       int start,
                       int len)
        Constructs a new LegType object from part of network-encoded data. The part starts at index start and is len bytes long. The data is not decoded and might not be decodable.
        Parameters:
        data - network-encoded data
        start - starting offset of network-encoded data in byte array
        len - default length if not predictable
        Throws:
        NullPointerException - if data is null
        IllegalArgumentException - if len is negative
      • LegType

        public LegType​(LegType.EncodedValue encodedValue)
        Constructs a new LegType object from given values for all fields.
        Parameters:
        encodedValue - the leg type value
      • LegType

        public LegType​(int arg)
        Constructs a new LegType object from the given int, making it be read-only (immutable).
        Parameters:
        arg - int
      • LegType

        public LegType​(DataInput in)
                throws IOException
        Constructs a new LegType object from data deserialized from a stream that was written by toStream(DataOutput).
        Parameters:
        in - the stream to read from
        Throws:
        EOFException - if reading is pre-empted by end-of-file
        IOException - if the data cannot be read
    • Method Detail

      • hasEncodedValue

        public boolean hasEncodedValue()
                                throws DecodeException
        Tests whether the field EncodedValue has a value.
        Returns:
        whether the field has a value
        Throws:
        DecodeException - if encoded state cannot be decoded
      • copyOf

        public static LegType copyOf​(LegType from)
        Creates a new object of this type, cloning the values of common fields from the given object of any subclass of the same base type.
        Parameters:
        from - the object from which to copy
        Returns:
        LegType
      • getFieldAccessors

        public static FieldAccessor[] getFieldAccessors()
        Gets a new array of the accessors for fields of this type.
        Returns:
        FieldAccessor[]
      • getFieldsMap

        public Map<String,​Object> getFieldsMap​(boolean withAbsents)
        Gets a Map from field-name to field-value for the fields of a sequence. For a field of primitive type, the field-value is boxed. For an absent optional field, the field-value is AbstractFieldsObject.FIELD_ABSENT. For an uninitialised mandatory field, the field-value is AbstractFieldsObject.FIELD_UNINITIALISED. For a field of String type, the encoded form is used if the String cannot be decoded. For a type that represents an OCTET STRING that cannot be decoded, a map from "encodedValue" to the byte array value is returned.
        Specified by:
        getFieldsMap in class AbstractFieldsObject
        Parameters:
        withAbsents - whether to put absent optional fields into Map
        Returns:
        Map from field-name to field-value
      • encodedIsInvalid

        protected boolean encodedIsInvalid()
        Determines whether the encoded form is invalid.
        Returns:
        boolean
      • getByteArrayForm

        public byte[] getByteArrayForm()
                                throws EncodeException
        Gets the byte array encoded form. The size of the array is the least of 1, 2, 4, or 8 according to the type's bounds. The most significant byte of the numeric value is in the lowest indexed byte of the array.
        Returns:
        byte array form
        Throws:
        EncodeException - if encoding fails
      • decodeLegType

        public static LegType decodeLegType​(Integer encoded)
        Helper method to decode Ericsson LegType fields encoded as ASN.1 integers.
      • encodeLegType

        public static Integer encodeLegType​(LegType legType)
        Helper method to encode Ericsson LegType fields as ASN.1 integers.