public ChannelUriStringBuilder validate ( ) { if ( null == media ) { throw new IllegalStateException ( "media type is mandatory" ) ; } if ( CommonContext . UDP_MEDIA . equals ( media ) && ( null == endpoint && null == controlEndpoint ) ) { throw new IllegalStateException ( "either 'endpoint' or 'control' must be specified for UDP." ) ; } int count = 0 ; count += null == initialTermId ? 0 : 1 ; count += null == termId ? 0 : 1 ; count += null == termOffset ? 0 : 1 ; if ( count > 0 ) { if ( count < 3 ) { throw new IllegalStateException ( "if any of then a complete set of 'initialTermId', 'termId', and 'termOffset' must be provided" ) ; } if ( termId - initialTermId < 0 ) // lgtm [java/dereferenced-value-may-be-null] { throw new IllegalStateException ( "difference greater than 2^31 - 1: termId=" + termId + " - initialTermId=" + initialTermId ) ; } if ( null != termLength && termOffset > termLength ) // lgtm [java/dereferenced-value-may-be-null] { throw new IllegalStateException ( "termOffset=" + termOffset + " > termLength=" + termLength ) ; } } return this ; }
Validates that the collection of set parameters are valid together .