boolean validate ( StringBuilder out ) { this . isValid = true ; // If log from construction has content, append to validation output msg. if ( this . msgLog . length ( ) > 0 ) { out . append ( this . msgLog ) ; } // Check that name is not null (it can be an empty string). if ( this . getName ( ) == null ) { this . isValid = false ; out . append ( " ** DatasetNamer (1): null value for name is not valid." ) ; } // Check that addLevel is not null. // boolean can't be null //if ( this.getAddLevel() == null) //{ // this.isValid = false; // out.append(" ** DatasetNamer (2): null value for addLevel is not valid."); //} // Check that type is not null. if ( this . getType ( ) == null ) { this . isValid = false ; out . append ( " ** DatasetNamer (3): null value for type is not valid (set with bad string?)." ) ; } if ( this . getType ( ) == DatasetNamerType . REGULAR_EXPRESSION && ( this . getMatchPattern ( ) == null || this . getSubstitutePattern ( ) == null ) ) { this . isValid = false ; out . append ( " ** DatasetNamer (4): invalid datasetNamer <" + this . getName ( ) + ">;" + " type is " + this . getType ( ) . toString ( ) + ": matchPattern(" + this . getMatchPattern ( ) + ") and substitutionPattern(" + this . getSubstitutePattern ( ) + ") " + "must not be null." ) ; } if ( this . getType ( ) == DatasetNamerType . DODS_ATTRIBUTE && ( this . getAttribContainer ( ) == null || this . getAttribName ( ) == null ) ) { this . isValid = false ; out . append ( " ** DatasetNamer (5): invalid datasetNamer <" + this . getName ( ) + ">;" + " type is " + this . getType ( ) . toString ( ) + ": attriuteContainer(" + this . getAttribContainer ( ) + ") and attributeName(" + this . getAttribName ( ) + ") must not be null." ) ; } return ( this . isValid ) ; }
Validate this DatasetNamer object . Return true if valid false if invalid .