public static void checkMessageId ( int messageId , AisMessageType ... messageTypes ) { boolean found = false ; for ( AisMessageType messageType : messageTypes ) { if ( messageType . getId ( ) == messageId ) found = true ; } if ( ! found ) { StringBuffer s = new StringBuffer ( ) ; for ( AisMessageType messageType : messageTypes ) { if ( s . length ( ) > 0 ) s . append ( "," ) ; s . append ( messageType . getId ( ) + "" ) ; } checkArgument ( found , "messageId must be in [" + s + "] but was " + messageId ) ; } }
Check message id corresponds to one of the given list of message types .