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 * https://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 * <strong>NOTE:</strong> This has been replaced by the new
26 * {@link org.apache.commons.validator.routines.ISBNValidator}.
27 *
28 * @since 1.2.0
29 * @deprecated Use the new ISBNValidator in the routines package
30 */
31 @Deprecated
32 public class ISBNValidator {
33
34 /**
35 * Constructs a new instance.
36 */
37 public ISBNValidator() {
38 }
39
40 /**
41 * If the ISBN is formatted with space or dash separators its format is
42 * validated. Then the digits in the number are weighted, summed, and
43 * divided by 11 according to the ISBN algorithm. If the result is zero,
44 * the ISBN is valid. This method accepts formatted or raw ISBN codes.
45 *
46 * @param isbn Candidate ISBN number to be validated. {@code null} is
47 * considered invalid.
48 * @return true if the string is a valid ISBN code.
49 */
50 public boolean isValid(final String isbn) {
51 return org.apache.commons.validator.routines.ISBNValidator.getInstance().isValidISBN10(isbn);
52 }
53
54 }