001 /*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements. See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License. You may obtain a copy of the License at
008 *
009 * http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017 package org.apache.commons.validator;
018
019 /**
020 * A class for validating 10 digit ISBN codes.
021 * Based on this
022 * <a href="http://www.isbn.org/standards/home/isbn/international/html/usm4.htm">
023 * algorithm</a>
024 *
025 * <b>NOTE:</b> This has been replaced by the new
026 * {@link org.apache.commons.validator.routines.ISBNValidator}.
027 *
028 * @version $Revision: 591503 $ $Date: 2007-11-03 00:00:06 +0100 (Sa, 03. Nov 2007) $
029 * @since Validator 1.2.0
030 * @deprecated Use the new ISBNValidator in the routines package
031 */
032 public class ISBNValidator {
033
034 /**
035 * Default Constructor.
036 */
037 public ISBNValidator() {
038 super();
039 }
040
041 /**
042 * If the ISBN is formatted with space or dash separators its format is
043 * validated. Then the digits in the number are weighted, summed, and
044 * divided by 11 according to the ISBN algorithm. If the result is zero,
045 * the ISBN is valid. This method accepts formatted or raw ISBN codes.
046 *
047 * @param isbn Candidate ISBN number to be validated. <code>null</code> is
048 * considered invalid.
049 * @return true if the string is a valid ISBN code.
050 */
051 public boolean isValid(String isbn) {
052 return org.apache.commons.validator.routines.ISBNValidator.getInstance().isValidISBN10(isbn);
053 }
054
055 }