From b13c129e20b4db1541da54536c65ff581eadbea0 Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Wed, 13 Apr 2016 16:25:58 +0200 Subject: [PATCH] Added exception which is thrown when the mobile provider with dial prefix and country has already been added. --- ...MobileProviderAlreadyCreatedException.java | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 src/org/mxchange/jphone/exceptions/MobileProviderAlreadyCreatedException.java diff --git a/src/org/mxchange/jphone/exceptions/MobileProviderAlreadyCreatedException.java b/src/org/mxchange/jphone/exceptions/MobileProviderAlreadyCreatedException.java new file mode 100644 index 0000000..b1d0535 --- /dev/null +++ b/src/org/mxchange/jphone/exceptions/MobileProviderAlreadyCreatedException.java @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2016 Roland Haeder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.mxchange.jphone.exceptions; + +import java.text.MessageFormat; +import org.mxchange.jphone.phonenumbers.mobileprovider.MobileProvider; + +/** + * An exception thrown when the mobile provider is already registered. This + * should be found out by checking dial prefix and country id in combination. + *

+ * @author Roland Haeder + */ +public class MobileProviderAlreadyCreatedException extends Exception { + + /** + * Serial number + */ + private static final long serialVersionUID = 16_857_128_756_894_186L; + + /** + * Constructor with mobile provider instance + *

+ * @param mobileProvider Mobile provider instance + */ + public MobileProviderAlreadyCreatedException (final MobileProvider mobileProvider) { + // Create message an call super constructor + super(MessageFormat.format("Mobile provider {0} with dial prefix {1} and country {2} has already been added.", mobileProvider.getProviderName(), mobileProvider.getProviderDialPrefix(), mobileProvider.getProviderCountry().getCountryCode())); //NOI18N + } + +} -- 2.39.5