001/*
002 * ============================================================================
003 * Copyright © 2002-2026 by Thomas Thrien.
004 * All Rights Reserved.
005 * ============================================================================
006 * Licensed to the public under the agreements of the GNU Lesser General Public
007 * License, version 3.0 (the "License"). You may obtain a copy of the License at
008 *
009 *      http://www.gnu.org/licenses/lgpl.html
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, WITHOUT
013 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
014 * License for the specific language governing permissions and limitations
015 * under the License.
016 */
017
018package org.tquadrat.foundation.exception;
019
020import static java.lang.String.format;
021import static org.apiguardian.api.API.Status.MAINTAINED;
022import static org.tquadrat.foundation.lang.Objects.nonNull;
023
024import java.io.Serial;
025
026import org.apiguardian.api.API;
027import org.tquadrat.foundation.annotation.ClassVersion;
028
029/**
030 *  <p>{@summary This is the common base class for specialised implementations
031 *  of
032 *  {@link IllegalArgumentException}.}
033 *
034 *  @author Thomas Thrien - thomas.thrien@tquadrat.org
035 *  @version $Id: InvalidArgumentException.java 1293 2026-10-16 13:12:15Z tquadrat $
036 *  @since 0.25.13
037 *
038 *  @UMLGraph.link
039 */
040@ClassVersion( sourceVersion = "$Id: InvalidArgumentException.java 1293 2026-10-16 13:12:15Z tquadrat $" )
041@API( status = MAINTAINED, since = "0.25.13" )
042abstract sealed class InvalidArgumentException extends ValidationException
043    permits BlankArgumentException, EmptyArgumentException, NullArgumentException
044{
045        /*------------------------*\
046    ====** Static Initialisations **===========================================
047        \*------------------------*/
048    /**
049     *  The serial version UID for objects of this class: {@value}.
050     *
051     *  @hidden
052     */
053    @Serial
054    private static final long serialVersionUID = 1174360235354917591L;
055
056        /*--------------*\
057    ====** Constructors **=====================================================
058        \*--------------*/
059    /**
060     *  <p>{@summary {@constructor}}</p>
061    *
062     *  @param  argName The name of the argument whose value was provided as
063     *      {@null}; if {@null} or the empty String, a
064     *      default message is used that does not use the name of the argument.
065     *  @param  msgName The regular message.
066     *  @param  msgNone The default message.
067     */
068    protected InvalidArgumentException( final String argName, final String msgName, final String msgNone )
069    {
070        super( nonNull( argName ) && !argName.isEmpty() ? format( msgName, argName ) : msgNone );
071    }   //  InvalidArgumentException()
072}
073//  class InvalidArgumentException
074
075/*
076 *  End of File
077 */