Class ForwardingOptions

  • All Implemented Interfaces:
    DataObject, FastSerializable, Serializable
    Direct Known Subclasses:
    ExtForwOptions

    public class ForwardingOptions
    extends AbstractLazyEncodedByteArray
    implements FastSerializable
    Class ForwardingOptions represents the ASN.1 OCTET STRING type MAP-SS-DataTypes.ForwardingOptions.

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

     ForwardingOptions ::= SEQUENCE {
         notificationToForwardingParty BOOLEAN,
         redirectingPresentation       BOOLEAN,
         notificationToCallingParty    BOOLEAN,
         forwardingReason              ForwardingReason
     }
    The class takes care of encoding the field values into a byte-array and decoding field values from a byte-array, the encoded representation being as tabulated below.

    Data Encoding - based on comment in ASN.1 module MAP-SS-DataTypes in 3GPP TS 29.002 V10.0.0 (2010-09) §17.7.4 p402
    87654321
    Octet 1Notification to forwarding party?Redirecting presentation?Notification to calling party?0Forwarding reason00

    Field names ending in ? are booleans: 1 for true, 0 for false.
    See Also:
    Serialized Form
    • Field Detail

      • NotificationToForwardingParty_value

        protected boolean NotificationToForwardingParty_value
        Value of field NotificationToForwardingParty.
      • NotificationToForwardingParty_present

        protected boolean NotificationToForwardingParty_present
        Whether field NotificationToForwardingParty is present.
      • RedirectingPresentation_value

        protected boolean RedirectingPresentation_value
        Value of field RedirectingPresentation.
      • RedirectingPresentation_present

        protected boolean RedirectingPresentation_present
        Whether field RedirectingPresentation is present.
      • NotificationToCallingParty_value

        protected boolean NotificationToCallingParty_value
        Value of field NotificationToCallingParty.
      • NotificationToCallingParty_present

        protected boolean NotificationToCallingParty_present
        Whether field NotificationToCallingParty is present.
    • Constructor Detail

      • ForwardingOptions

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

        public ForwardingOptions​(byte[] data)
        Constructs a new ForwardingOptions 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
      • ForwardingOptions

        public ForwardingOptions​(byte[] data,
                                 int start,
                                 int len)
        Constructs a new ForwardingOptions 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
      • ForwardingOptions

        public ForwardingOptions​(boolean notificationToForwardingParty,
                                 boolean redirectingPresentation,
                                 boolean notificationToCallingParty,
                                 ForwardingOptions.ForwardingReason forwardingReason)
        Constructs a new ForwardingOptions object from given values for all fields.
        Parameters:
        notificationToForwardingParty - Notification to forwarding party
        redirectingPresentation - Redirecting presentation
        notificationToCallingParty - Notification to calling party
        forwardingReason - Forwarding reason
      • ForwardingOptions

        public ForwardingOptions​(DataInput in)
                          throws IOException
        Constructs a new ForwardingOptions 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

      • hasNotificationToForwardingParty

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

        public ForwardingOptions setNotificationToForwardingPartyPresent​(boolean flag)
                                                                  throws IllegalStateException
        Sets the presence or absence of the field NotificationToForwardingParty.
        Parameters:
        flag - whether the field should be marked as present
        Returns:
        this
        Throws:
        IllegalStateException - if this instance has been marked as read-only
      • hasRedirectingPresentation

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

        public ForwardingOptions setRedirectingPresentationPresent​(boolean flag)
                                                            throws IllegalStateException
        Sets the presence or absence of the field RedirectingPresentation.
        Parameters:
        flag - whether the field should be marked as present
        Returns:
        this
        Throws:
        IllegalStateException - if this instance has been marked as read-only
      • hasNotificationToCallingParty

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

        public ForwardingOptions setNotificationToCallingPartyPresent​(boolean flag)
                                                               throws IllegalStateException
        Sets the presence or absence of the field NotificationToCallingParty.
        Parameters:
        flag - whether the field should be marked as present
        Returns:
        this
        Throws:
        IllegalStateException - if this instance has been marked as read-only
      • hasForwardingReason

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

        public boolean getNotificationToForwardingParty()
                                                 throws DecodeException
        Gets the value of Notification to forwarding party.
        Returns:
        boolean representation of Notification to forwarding party
        Throws:
        DecodeException - if encoded state cannot be decoded
      • getRedirectingPresentation

        public boolean getRedirectingPresentation()
                                           throws DecodeException
        Gets the value of Redirecting presentation.
        Returns:
        boolean representation of Redirecting presentation
        Throws:
        DecodeException - if encoded state cannot be decoded
      • getNotificationToCallingParty

        public boolean getNotificationToCallingParty()
                                              throws DecodeException
        Gets the value of Notification to calling party.
        Returns:
        boolean representation of Notification to calling party
        Throws:
        DecodeException - if encoded state cannot be decoded
      • setNotificationToForwardingParty

        public ForwardingOptions setNotificationToForwardingParty​(boolean value)
                                                           throws IllegalStateException
        Sets the value of Notification to forwarding party.
        Parameters:
        value - boolean representation of Notification to forwarding party
        Returns:
        this
        Throws:
        IllegalStateException
      • setNotificationToCallingParty

        public ForwardingOptions setNotificationToCallingParty​(boolean value)
                                                        throws IllegalStateException
        Sets the value of Notification to calling party.
        Parameters:
        value - boolean representation of Notification to calling party
        Returns:
        this
        Throws:
        IllegalStateException
      • copyOf

        public static ForwardingOptions copyOf​(ForwardingOptions 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:
        ForwardingOptions
      • 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
      • getEncodedForm

        public byte[] getEncodedForm()
                              throws EncodeException
        Gets the encoded form.
        Returns:
        encoded form
        Throws:
        EncodeException - if encoding fails
      • getContainedLength

        public static int getContainedLength​(byte[] data,
                                             int start,
                                             int len)
        Determines the length of the encoded value that commences at offset start in the given data. The value is not fully decoded and might not be decodable. Values of this type are of a fixed length, so that length is returned if the data is long enough, otherwise 0 is returned.
        Parameters:
        data - network-encoded data
        start - index into data where value commences
        len - length in data to be considered
        Returns:
        1, or 0 if encoded value is not long enough