Coverage Report - org.apache.commons.validator.ISBNValidator
 
Classes in this File Line Coverage Branch Coverage Complexity
ISBNValidator
100%
3/3
N/A
1
 
 1  
 /*
 2  
  * Licensed to the Apache Software Foundation (ASF) under one or more
 3  
  * contributor license agreements.  See the NOTICE file distributed with
 4  
  * this work for additional information regarding copyright ownership.
 5  
  * The ASF licenses this file to You under the Apache License, Version 2.0
 6  
  * (the "License"); you may not use this file except in compliance with
 7  
  * the License.  You may obtain a copy of the License at
 8  
  *
 9  
  *      http://www.apache.org/licenses/LICENSE-2.0
 10  
  *
 11  
  * Unless required by applicable law or agreed to in writing, software
 12  
  * distributed under the License is distributed on an "AS IS" BASIS,
 13  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 14  
  * See the License for the specific language governing permissions and
 15  
  * limitations under the License.
 16  
  */
 17  
 package org.apache.commons.validator;
 18  
 
 19  
 /**
 20  
  * A class for validating 10 digit ISBN codes.
 21  
  * Based on this 
 22  
  * <a href="http://www.isbn.org/standards/home/isbn/international/html/usm4.htm">
 23  
  * algorithm</a>
 24  
  *
 25  
  * <b>NOTE:</b> This has been replaced by the new
 26  
  *  {@link org.apache.commons.validator.routines.ISBNValidator}.
 27  
  *
 28  
  * @version $Revision: 1739358 $
 29  
  * @since Validator 1.2.0
 30  
  * @deprecated Use the new ISBNValidator in the routines package
 31  
  */
 32  
 @Deprecated
 33  
 public class ISBNValidator {
 34  
 
 35  
     /**
 36  
      * Default Constructor.
 37  
      */
 38  
     public ISBNValidator() {
 39  1
         super();
 40  1
     }
 41  
 
 42  
     /**
 43  
      * If the ISBN is formatted with space or dash separators its format is
 44  
      * validated.  Then the digits in the number are weighted, summed, and
 45  
      * divided by 11 according to the ISBN algorithm.  If the result is zero,
 46  
      * the ISBN is valid.  This method accepts formatted or raw ISBN codes.
 47  
      *
 48  
      * @param isbn Candidate ISBN number to be validated. <code>null</code> is
 49  
      * considered invalid.
 50  
      * @return true if the string is a valid ISBN code.
 51  
      */
 52  
     public boolean isValid(String isbn) {
 53  15
         return org.apache.commons.validator.routines.ISBNValidator.getInstance().isValidISBN10(isbn);
 54  
     }
 55  
 
 56  
 }