Source code
Description: source: package: org.apache.commons.validator, class: ISBNValidator

    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 *      https://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
    018package org.apache.commons.validator;
    019
    020/**
    021 * A class for validating 10 digit ISBN codes. Based on this <a href="https://www.isbn.org/standards/home/isbn/international/html/usm4.htm"> algorithm</a>
    022 * <p>
    023 * <strong>NOTE:</strong> This has been replaced by the new {@link ISBNValidator}.
    024 * </p>
    025 *
    026 * @since 1.2.0
    027 * @deprecated Use the new ISBNValidator in the routines package
    028 */
    029@Deprecated
    030public class ISBNValidator {
    031
    032    /**
    033     * Constructs a new instance.
    034     */
    035    public ISBNValidator() {
    036    }
    037
    038    /**
    039     * If the ISBN is formatted with space or dash separators its format is validated. Then the digits in the number are weighted, summed, and divided by 11
    040     * according to the ISBN algorithm. If the result is zero, the ISBN is valid. This method accepts formatted or raw ISBN codes.
    041     *
    042     * @param isbn Candidate ISBN number to be validated. {@code null} is considered invalid.
    043     * @return true if the string is a valid ISBN code.
    044     */
    045    public boolean isValid(final String isbn) {
    046        return org.apache.commons.validator.routines.ISBNValidator.getInstance().isValidISBN10(isbn);
    047    }
    048}