001/* 002 * GeoAPI - Java interfaces for OGC/ISO standards 003 * Copyright © 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.util; 019 020import org.opengis.geoapi.internal.Errors; 021 022 023/** 024 * Thrown when a factory does not implement a method. 025 * The unimplemented service may be the creation of instances of some type, 026 * or the parsing of texts in <i>Well-Known Text</i> (<abbr>WKT</abbr>) 027 * or <i>Geographic Markup Language</i> (<abbr>GML</abbr>) formats. 028 * 029 * @author Martin Desruisseaux (Geomatys) 030 * @version 3.1 031 * @since 3.1 032 */ 033public class UnimplementedServiceException extends FactoryException { 034 /** 035 * Serial number for inter-operability with different versions. 036 */ 037 private static final long serialVersionUID = 7527916609849976921L; 038 039 /** 040 * Constructs an exception with the specified detail message. 041 * 042 * @param message the detail message, saved for later retrieval by the {@link #getMessage()} method. 043 */ 044 public UnimplementedServiceException(final String message) { 045 super(message); 046 } 047 048 /** 049 * Constructs an exception with a message inferred from the specified factory and object type. 050 * 051 * @param factory the factory on which a {@code createFoo(…)} method has been invoked. 052 * @param type the type of object that the user requested. 053 */ 054 public UnimplementedServiceException(final Factory factory, final Class<?> type) { 055 super(Errors.cannotCreate(factory, type, null)); 056 } 057 058 /** 059 * Constructs an exception with a message inferred from the specified factory, object type and variant. 060 * The exact message formatted by this constructor is unspecified. 061 * 062 * @param factory the factory on which a {@code createFoo(…)} method has been invoked. 063 * @param type the type of object that the user requested. 064 * @param variant variant of the type (e.g. "2D", "3D", "spherical", "Cartesian"), or {@code null} if none. 065 */ 066 public UnimplementedServiceException(final Factory factory, final Class<?> type, final String variant) { 067 super(Errors.cannotCreate(factory, type, variant)); 068 } 069}