]> git.mxchange.org Git - jphone-core.git/commitdiff
Added exception which is thrown when the mobile provider with dial prefix and country...
authorRoland Haeder <roland@mxchange.org>
Wed, 13 Apr 2016 14:25:58 +0000 (16:25 +0200)
committerRoland Haeder <roland@mxchange.org>
Wed, 13 Apr 2016 14:25:58 +0000 (16:25 +0200)
src/org/mxchange/jphone/exceptions/MobileProviderAlreadyCreatedException.java [new file with mode: 0644]

diff --git a/src/org/mxchange/jphone/exceptions/MobileProviderAlreadyCreatedException.java b/src/org/mxchange/jphone/exceptions/MobileProviderAlreadyCreatedException.java
new file mode 100644 (file)
index 0000000..b1d0535
--- /dev/null
@@ -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 <http://www.gnu.org/licenses/>.
+ */
+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.
+ * <p>
+ * @author Roland Haeder<roland@mxchange.org>
+ */
+public class MobileProviderAlreadyCreatedException extends Exception {
+
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 16_857_128_756_894_186L;
+
+       /**
+        * Constructor with mobile provider instance
+        * <p>
+        * @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
+       }
+
+}