]> git.mxchange.org Git - addressbook-war.git/commitdiff
Please cherry-pick:
authorRoland Häder <roland@mxchange.org>
Thu, 27 Jul 2017 20:39:58 +0000 (22:39 +0200)
committerRoland Häder <roland@mxchange.org>
Fri, 28 Jul 2017 21:42:33 +0000 (23:42 +0200)
- improved exception message when the expected interface is not implemented
  (meaning wrong call)
- now the value's simple class name is being included

Signed-off-by: Roland Häder <roland@mxchange.org>
src/java/org/mxchange/addressbook/converter/businesscontact/AddressbookBusinessContactConverter.java
src/java/org/mxchange/addressbook/converter/contact/AddressbookContactConverter.java
src/java/org/mxchange/addressbook/converter/country/AddressbookCountryConverter.java
src/java/org/mxchange/addressbook/converter/fax/AddressbookFaxNumberConverter.java
src/java/org/mxchange/addressbook/converter/landline/AddressbookLandLineNumberConverter.java
src/java/org/mxchange/addressbook/converter/mobile/AddressbookMobileNumberConverter.java
src/java/org/mxchange/addressbook/converter/mobileprovider/AddressbookMobileProviderConverter.java
src/java/org/mxchange/addressbook/converter/user/AddressbookUserConverter.java
src/java/org/mxchange/addressbook/validator/user/AddressbookUserIdValidator.java

index 24cc4cbdc5d32a09733f1fb770fa79d2134d522f..0af4cb5398df02c4ed92e275d1e5ae6ad381fed9 100644 (file)
@@ -44,7 +44,7 @@ public class AddressbookBusinessContactConverter implements Converter {
        private static BusinessDataSessionBeanRemote BUSINESS_CONTACT_BEAN;
 
        /**
-        * Initialization of this converter
+        * Default constructor
         */
        public AddressbookBusinessContactConverter () {
        }
@@ -100,15 +100,15 @@ public class AddressbookBusinessContactConverter implements Converter {
        @Override
        public String getAsString (final FacesContext context, final UIComponent component, final Object value) {
                // Is the object null?
-               if ((null == value) || ((String.valueOf(value)).isEmpty())) {
+               if ((null == value) || (String.valueOf(value).isEmpty())) {
                        // Is null
                        return ""; //NOI18N
                } else if (!(value instanceof Contact)) {
                        // Not same interface
-                       throw new IllegalArgumentException(MessageFormat.format("value {0} does not implement Contact.", value)); //NOI18N
+                       throw new IllegalArgumentException(MessageFormat.format("value[]={0} does not implement Contact.", value.getClass().getSimpleName())); //NOI18N
                }
 
-               // Return category id
+               // Return id number
                return String.valueOf(((BusinessBasicData) value).getBusinessDataId());
        }
 
index 9cc95acf6c951fadf46eb1c34907d7171e0302f1..6f4536f44ce10d48bce8cf9a10f365042e776657 100644 (file)
@@ -43,7 +43,7 @@ public class AddressbookContactConverter implements Converter {
        private static ContactSessionBeanRemote CONTACT_BEAN;
 
        /**
-        * Initialization of this converter
+        * Default constructor
         */
        public AddressbookContactConverter () {
        }
@@ -99,15 +99,15 @@ public class AddressbookContactConverter implements Converter {
        @Override
        public String getAsString (final FacesContext context, final UIComponent component, final Object value) {
                // Is the object null?
-               if ((null == value) || ((String.valueOf(value)).isEmpty())) {
+               if ((null == value) || (String.valueOf(value).isEmpty())) {
                        // Is null
                        return ""; //NOI18N
                } else if (!(value instanceof Contact)) {
                        // Not same interface
-                       throw new IllegalArgumentException(MessageFormat.format("value {0} does not implement Contact.", value)); //NOI18N
+                       throw new IllegalArgumentException(MessageFormat.format("value[]={0} does not implement Contact.", value.getClass().getSimpleName())); //NOI18N
                }
 
-               // Return category id
+               // Return id number
                return String.valueOf(((Contact) value).getContactId());
        }
 
index 7293b9d4c46252fd8902a534ebe87e1718f792ca..7de496118f0372c3d621c32da14821b84e303807 100644 (file)
@@ -44,7 +44,7 @@ public class AddressbookCountryConverter implements Converter {
        private static CountrySingletonBeanRemote COUNTRY_BEAN;
 
        /**
-        * Initialization of this converter
+        * Default constructor
         */
        public AddressbookCountryConverter () {
        }
@@ -111,15 +111,15 @@ public class AddressbookCountryConverter implements Converter {
        @Override
        public String getAsString (final FacesContext context, final UIComponent component, final Object value) {
                // Is the object null?
-               if ((null == value) || ((String.valueOf(value)).isEmpty())) {
+               if ((null == value) || (String.valueOf(value).isEmpty())) {
                        // Is null
                        return ""; //NOI18N
                } else if (!(value instanceof Country)) {
                        // Not same interface
-                       throw new IllegalArgumentException(MessageFormat.format("value {0} does not implement Country.", value)); //NOI18N
+                       throw new IllegalArgumentException(MessageFormat.format("value[]={0} does not implement Country.", value.getClass().getSimpleName())); //NOI18N
                }
 
-               // Return category id
+               // Return id number
                return String.valueOf(((Country) value).getCountryId());
        }
 
index 3d1f7d73e38c8b7a7ab1e2be9e12ab118306f469..753bc47d91a1a91199f61aa0bf5e9c8f67bc2f5c 100644 (file)
@@ -44,7 +44,7 @@ public class AddressbookFaxNumberConverter implements Converter {
        private static PhoneSessionBeanRemote PHONE_BEAN;
 
        /**
-        * Initialization of this converter
+        * Default constructor
         */
        public AddressbookFaxNumberConverter () {
        }
@@ -107,15 +107,15 @@ public class AddressbookFaxNumberConverter implements Converter {
        @Override
        public String getAsString (final FacesContext context, final UIComponent component, final Object value) {
                // Is the object null?
-               if ((null == value) || ((String.valueOf(value)).isEmpty())) {
+               if ((null == value) || (String.valueOf(value).isEmpty())) {
                        // Is null
                        return ""; //NOI18N
                } else if (!(value instanceof DialableNumber)) {
                        // Not same interface
-                       throw new IllegalArgumentException(MessageFormat.format("value {0} does not implement DialableNumber.", value)); //NOI18N
+                       throw new IllegalArgumentException(MessageFormat.format("value[]={0} does not implement DialableNumber.", value.getClass().getSimpleName())); //NOI18N
                }
 
-               // Return category id
+               // Return id number
                return String.valueOf(((DialableNumber) value).getPhoneId());
        }
 
index 8d718362e57bc5658ef3124a8d49b853316968ee..91e37aa555223863168863fee1fcb449768e2025 100644 (file)
@@ -44,7 +44,7 @@ public class AddressbookLandLineNumberConverter implements Converter {
        private static PhoneSessionBeanRemote PHONE_BEAN;
 
        /**
-        * Initialization of this converter
+        * Default constructor
         */
        public AddressbookLandLineNumberConverter () {
        }
@@ -100,15 +100,15 @@ public class AddressbookLandLineNumberConverter implements Converter {
        @Override
        public String getAsString (final FacesContext context, final UIComponent component, final Object value) {
                // Is the object null?
-               if ((null == value) || ((String.valueOf(value)).isEmpty())) {
+               if ((null == value) || (String.valueOf(value).isEmpty())) {
                        // Is null
                        return ""; //NOI18N
                } else if (!(value instanceof DialableNumber)) {
                        // Not same interface
-                       throw new IllegalArgumentException(MessageFormat.format("value {0} does not implement DialableNumber.", value)); //NOI18N
+                       throw new IllegalArgumentException(MessageFormat.format("value[]={0} does not implement DialableNumber.", value.getClass().getSimpleName())); //NOI18N
                }
 
-               // Return category id
+               // Return id number
                return String.valueOf(((DialableNumber) value).getPhoneId());
        }
 
index aa5f8005594c5173cc6c20d5de6ca36ea3876f85..8bb07d26340cfdc13c8e5ead9e49613f2c327a3d 100644 (file)
@@ -44,7 +44,7 @@ public class AddressbookMobileNumberConverter implements Converter {
        private static PhoneSessionBeanRemote PHONE_BEAN;
 
        /**
-        * Initialization of this converter
+        * Default constructor
         */
        public AddressbookMobileNumberConverter () {
        }
@@ -100,15 +100,15 @@ public class AddressbookMobileNumberConverter implements Converter {
        @Override
        public String getAsString (final FacesContext context, final UIComponent component, final Object value) {
                // Is the object null?
-               if ((null == value) || ((String.valueOf(value)).isEmpty())) {
+               if ((null == value) || (String.valueOf(value).isEmpty())) {
                        // Is null
                        return ""; //NOI18N
                } else if (!(value instanceof DialableNumber)) {
                        // Not same interface
-                       throw new IllegalArgumentException(MessageFormat.format("value {0} does not implement DialableNumber.", value)); //NOI18N
+                       throw new IllegalArgumentException(MessageFormat.format("value[]={0} does not implement DialableNumber.", value.getClass().getSimpleName())); //NOI18N
                }
 
-               // Return category id
+               // Return id number
                return String.valueOf(((DialableNumber) value).getPhoneId());
        }
 
index fa42cfe055dedca1bae65a7b0bfb0cbcf0b7b2bf..c9f3accd753f04e361262c9f58a8607a1aec44b6 100644 (file)
@@ -44,7 +44,7 @@ public class AddressbookMobileProviderConverter implements Converter {
        private static MobileProviderSingletonBeanRemote MOBILE_PROVIDER_BEAN;
 
        /**
-        * Initialization of this converter
+        * Default constructor
         */
        public AddressbookMobileProviderConverter () {
        }
@@ -111,15 +111,15 @@ public class AddressbookMobileProviderConverter implements Converter {
        @Override
        public String getAsString (final FacesContext context, final UIComponent component, final Object value) {
                // Is the object null?
-               if ((null == value) || ((String.valueOf(value)).isEmpty())) {
+               if ((null == value) || (String.valueOf(value).isEmpty())) {
                        // Is null
                        return ""; //NOI18N
                } else if (!(value instanceof MobileProvider)) {
                        // Not same interface
-                       throw new IllegalArgumentException(MessageFormat.format("value {0} does not implement MobileProvider.", value)); //NOI18N
+                       throw new IllegalArgumentException(MessageFormat.format("value[]={0} does not implement MobileProvider.", value.getClass().getSimpleName())); //NOI18N
                }
 
-               // Return category id
+               // Return id number
                return String.valueOf(((MobileProvider) value).getProviderId());
        }
 
index 3a6d706dd73f9b695e1f358a6b7ce538f7bd8cbd..c888a3d841da73ab22d84ac32b6690b289754360 100644 (file)
@@ -43,7 +43,7 @@ public class AddressbookUserConverter implements Converter {
        private static UserSessionBeanRemote USER_BEAN;
 
        /**
-        * Initialization of this converter
+        * Default constructor
         */
        public AddressbookUserConverter () {
        }
@@ -99,15 +99,15 @@ public class AddressbookUserConverter implements Converter {
        @Override
        public String getAsString (final FacesContext context, final UIComponent component, final Object value) {
                // Is the object null?
-               if ((null == value) || ((String.valueOf(value)).isEmpty())) {
+               if ((null == value) || (String.valueOf(value).isEmpty())) {
                        // Is null
                        return ""; //NOI18N
                } else if (!(value instanceof User)) {
                        // Not same interface
-                       throw new IllegalArgumentException(MessageFormat.format("value {0} does not implement User.", value)); //NOI18N
+                       throw new IllegalArgumentException(MessageFormat.format("value[]={0} does not implement User.", value.getClass().getSimpleName())); //NOI18N
                }
 
-               // Return category id
+               // Return id number
                return String.valueOf(((User) value).getUserId());
        }
 }
index 29ff683f2ff688bcd86e6101d30538b4045baf6c..aca92c0ba43ef3d35005a0885175f0da9f4a1437 100644 (file)
@@ -49,7 +49,7 @@ public class AddressbookUserIdValidator extends BaseLongValidator implements Val
        private static final long serialVersionUID = 12_869_569_314_764_690L;
 
        /**
-        * Initialization of this converter
+        * Default constructor
         */
        public AddressbookUserIdValidator () {
        }