boolean validate ( StringBuilder out ) { this . isValid = true ; // If log from construction has content, append to validation output msg. if ( this . log . length ( ) > 0 ) { out . append ( this . log ) ; } // Validity check: 'name' cannot be null. (Though, 'name' // can be an empty string.) if ( this . getName ( ) == null ) { isValid = false ; out . append ( " ** DatasetFilter (4): null value for name is not valid." ) ; } // Check that type is not null. if ( this . getType ( ) == null ) { isValid = false ; out . append ( " ** DatasetFilter (5): null value for type is not valid (set with bad string?)." ) ; } // Validity check: 'matchPattern' must be null if 'type' value // is not 'RegExp'. if ( this . type == DatasetFilter . Type . REGULAR_EXPRESSION && this . matchPattern == null ) { isValid = false ; out . append ( " ** DatasetFilter (6): null value for matchPattern not valid when type is 'RegExp'." ) ; } if ( this . type != DatasetFilter . Type . REGULAR_EXPRESSION && this . type != null && this . matchPattern != null ) { isValid = false ; out . append ( " ** DatasetFilter (7): matchPattern value (" + this . matchPattern + ") must be null if type is not 'RegExp'." ) ; } return ( this . isValid ) ; }
Validate this DatasetFilter object . Return true if valid false if invalid .