@Override
    protected void printAttributes(StringBuilder xml) {
      // direction
      MediaDirection direction = getDirection();

      if ((direction != null) && (direction != MediaDirection.SENDRECV)) {
        xml.append(' ')
            .append(DIRECTION_ATTR_NAME)
            .append("='")
            .append(direction.toString())
            .append('\'');
      }

      // host
      String host = getHost();

      if (host != null) {
        xml.append(' ').append(HOST_ATTR_NAME).append("='").append(host).append('\'');
      }

      // id
      String id = getID();

      if (id != null) {
        xml.append(' ').append(ID_ATTR_NAME).append("='").append(id).append('\'');
      }

      // lastN
      Integer lastN = getLastN();

      if (lastN != null) {
        xml.append(' ').append(LAST_N_ATTR_NAME).append("='").append(lastN).append('\'');
      }

      // rtcpPort
      int rtcpPort = getRTCPPort();

      if (rtcpPort > 0) {
        xml.append(' ').append(RTCP_PORT_ATTR_NAME).append("='").append(rtcpPort).append('\'');
      }

      // rtpLevelRelayType
      RTPLevelRelayType rtpLevelRelayType = getRTPLevelRelayType();

      if (rtpLevelRelayType != null) {
        xml.append(' ')
            .append(RTP_LEVEL_RELAY_TYPE_ATTR_NAME)
            .append("='")
            .append(rtpLevelRelayType)
            .append('\'');
      }

      // rtpPort
      int rtpPort = getRTPPort();

      if (rtpPort > 0) {
        xml.append(' ').append(RTP_PORT_ATTR_NAME).append("='").append(rtpPort).append('\'');
      }
    }
예제 #2
0
 /**
  * Asserts that the state of this instance will remain consistent if a specific
  * <tt>MediaDirection</tt> (i.e. <tt>direction</tt>) and a <tt>MediaDevice</tt> with a specific
  * <tt>MediaDirection</tt> (i.e. <tt>deviceDirection</tt>) are both set on this instance.
  *
  * @param direction the <tt>MediaDirection</tt> to validate against the specified
  *     <tt>deviceDirection</tt>
  * @param deviceDirection the <tt>MediaDirection</tt> of a <tt>MediaDevice</tt> to validate
  *     against the specified <tt>direction</tt>
  * @param illegalArgumentExceptionMessage the message of the <tt>IllegalArgumentException</tt> to
  *     be thrown if the state of this instance would've been compromised if <tt>direction</tt> and
  *     the <tt>MediaDevice</tt> associated with <tt>deviceDirection</tt> were both set on this
  *     instance
  * @throws IllegalArgumentException if the state of this instance would've been compromised were
  *     both <tt>direction</tt> and the <tt>MediaDevice</tt> associated with
  *     <tt>deviceDirection</tt> set on this instance
  */
 protected void assertDirection(
     MediaDirection direction,
     MediaDirection deviceDirection,
     String illegalArgumentExceptionMessage)
     throws IllegalArgumentException {
   if ((direction != null) && !direction.and(deviceDirection).equals(direction))
     throw new IllegalArgumentException(illegalArgumentExceptionMessage);
 }