001/*
002 *    GeoAPI - Java interfaces for OGC/ISO standards
003 *    Copyright © 2015-2023 Open Geospatial Consortium, Inc.
004 *    http://www.geoapi.org
005 *
006 *    Licensed under the Apache License, Version 2.0 (the "License");
007 *    you may not use this file except in compliance with the License.
008 *    You may obtain a copy of the License at
009 *
010 *        http://www.apache.org/licenses/LICENSE-2.0
011 *
012 *    Unless required by applicable law or agreed to in writing, software
013 *    distributed under the License is distributed on an "AS IS" BASIS,
014 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 *    See the License for the specific language governing permissions and
016 *    limitations under the License.
017 */
018package org.opengis.feature;
019
020
021/**
022 * Thrown when {@link FeatureType#newInstance()} is invoked but the feature cannot be instantiated.
023 * The instantiation can fail for a variety of reasons including but not limited to:
024 *
025 * <ul>
026 *   <li>the feature type {@linkplain FeatureType#isAbstract() is abstract},</li>
027 *   <li>the feature type definition is incomplete.</li>
028 * </ul>
029 *
030 * <div class="note"><b>Analogy with Java reflection</b>:
031 * if we compare {@code FeatureType} to {@link Class} and {@code Feature} to {@link Object} in the Java language,
032 * then this exception is equivalent to {@link java.lang.InstantiationException}.</div>
033 *
034 * @author  Martin Desruisseaux (Geomatys)
035 * @version 3.1
036 * @since   3.1
037 *
038 * @see FeatureType#newInstance()
039 */
040public class FeatureInstantiationException extends IllegalStateException {
041    /**
042     * Serial number for inter-operability with different versions.
043     */
044    private static final long serialVersionUID = 2453228493560053757L;
045
046    /**
047     * Creates an exception with no message.
048     */
049    public FeatureInstantiationException() {
050        super();
051    }
052
053    /**
054     * Creates an exception with the specified message.
055     *
056     * @param message  the detail message, saved for later retrieval by the {@link #getMessage()} method.
057     */
058    public FeatureInstantiationException(final String message) {
059        super(message);
060    }
061
062    /**
063     * Creates an exception with the specified message and cause.
064     *
065     * @param message  the detail message, saved for later retrieval by the {@link #getMessage()} method.
066     * @param cause    the cause, saved for later retrieval by the {@link #getCause()} method.
067     */
068    public FeatureInstantiationException(final String message, final Throwable cause) {
069        super(message, cause);
070    }
071}