From 48f4b8c34e4a48f9cdcef1cfa3c1d091a2c4ed95 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Thu, 27 Jul 2017 22:39:58 +0200 Subject: [PATCH] Please cherry-pick: - improved exception message when the expected interface is not implemented (meaning wrong call) - now the value's simple class name is being included MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- .../FinancialsBusinessContactConverter.java | 8 ++++---- .../converter/contact/FinancialsContactConverter.java | 8 ++++---- .../converter/country/FinancialsCountryConverter.java | 8 ++++---- .../converter/fax/FinancialsFaxNumberConverter.java | 8 ++++---- .../landline/FinancialsLandLineNumberConverter.java | 8 ++++---- .../converter/mobile/FinancialsMobileNumberConverter.java | 8 ++++---- .../mobileprovider/FinancialsMobileProviderConverter.java | 8 ++++---- .../converter/user/FinancialsUserConverter.java | 8 ++++---- .../validator/user/FinancialsUserIdValidator.java | 2 +- 9 files changed, 33 insertions(+), 33 deletions(-) diff --git a/src/java/org/mxchange/jfinancials/converter/businesscontact/FinancialsBusinessContactConverter.java b/src/java/org/mxchange/jfinancials/converter/businesscontact/FinancialsBusinessContactConverter.java index 62b6991b..491531c1 100644 --- a/src/java/org/mxchange/jfinancials/converter/businesscontact/FinancialsBusinessContactConverter.java +++ b/src/java/org/mxchange/jfinancials/converter/businesscontact/FinancialsBusinessContactConverter.java @@ -44,7 +44,7 @@ public class FinancialsBusinessContactConverter implements Converter { private static BusinessDataSessionBeanRemote BUSINESS_CONTACT_BEAN; /** - * Initialization of this converter + * Default constructor */ public FinancialsBusinessContactConverter () { } @@ -100,15 +100,15 @@ public class FinancialsBusinessContactConverter 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()); } diff --git a/src/java/org/mxchange/jfinancials/converter/contact/FinancialsContactConverter.java b/src/java/org/mxchange/jfinancials/converter/contact/FinancialsContactConverter.java index 5a2501e4..3516acd8 100644 --- a/src/java/org/mxchange/jfinancials/converter/contact/FinancialsContactConverter.java +++ b/src/java/org/mxchange/jfinancials/converter/contact/FinancialsContactConverter.java @@ -43,7 +43,7 @@ public class FinancialsContactConverter implements Converter { private static ContactSessionBeanRemote CONTACT_BEAN; /** - * Initialization of this converter + * Default constructor */ public FinancialsContactConverter () { } @@ -99,15 +99,15 @@ public class FinancialsContactConverter 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()); } diff --git a/src/java/org/mxchange/jfinancials/converter/country/FinancialsCountryConverter.java b/src/java/org/mxchange/jfinancials/converter/country/FinancialsCountryConverter.java index 1b5978da..51796b69 100644 --- a/src/java/org/mxchange/jfinancials/converter/country/FinancialsCountryConverter.java +++ b/src/java/org/mxchange/jfinancials/converter/country/FinancialsCountryConverter.java @@ -44,7 +44,7 @@ public class FinancialsCountryConverter implements Converter { private static CountrySingletonBeanRemote COUNTRY_BEAN; /** - * Initialization of this converter + * Default constructor */ public FinancialsCountryConverter () { } @@ -111,15 +111,15 @@ public class FinancialsCountryConverter 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()); } diff --git a/src/java/org/mxchange/jfinancials/converter/fax/FinancialsFaxNumberConverter.java b/src/java/org/mxchange/jfinancials/converter/fax/FinancialsFaxNumberConverter.java index 3bb2bf25..075887d8 100644 --- a/src/java/org/mxchange/jfinancials/converter/fax/FinancialsFaxNumberConverter.java +++ b/src/java/org/mxchange/jfinancials/converter/fax/FinancialsFaxNumberConverter.java @@ -44,7 +44,7 @@ public class FinancialsFaxNumberConverter implements Converter { private static PhoneSessionBeanRemote PHONE_BEAN; /** - * Initialization of this converter + * Default constructor */ public FinancialsFaxNumberConverter () { } @@ -107,15 +107,15 @@ public class FinancialsFaxNumberConverter 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()); } diff --git a/src/java/org/mxchange/jfinancials/converter/landline/FinancialsLandLineNumberConverter.java b/src/java/org/mxchange/jfinancials/converter/landline/FinancialsLandLineNumberConverter.java index aa641262..60b88700 100644 --- a/src/java/org/mxchange/jfinancials/converter/landline/FinancialsLandLineNumberConverter.java +++ b/src/java/org/mxchange/jfinancials/converter/landline/FinancialsLandLineNumberConverter.java @@ -44,7 +44,7 @@ public class FinancialsLandLineNumberConverter implements Converter { private static PhoneSessionBeanRemote PHONE_BEAN; /** - * Initialization of this converter + * Default constructor */ public FinancialsLandLineNumberConverter () { } @@ -100,15 +100,15 @@ public class FinancialsLandLineNumberConverter 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()); } diff --git a/src/java/org/mxchange/jfinancials/converter/mobile/FinancialsMobileNumberConverter.java b/src/java/org/mxchange/jfinancials/converter/mobile/FinancialsMobileNumberConverter.java index e5d99653..737c6acb 100644 --- a/src/java/org/mxchange/jfinancials/converter/mobile/FinancialsMobileNumberConverter.java +++ b/src/java/org/mxchange/jfinancials/converter/mobile/FinancialsMobileNumberConverter.java @@ -44,7 +44,7 @@ public class FinancialsMobileNumberConverter implements Converter { private static PhoneSessionBeanRemote PHONE_BEAN; /** - * Initialization of this converter + * Default constructor */ public FinancialsMobileNumberConverter () { } @@ -100,15 +100,15 @@ public class FinancialsMobileNumberConverter 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()); } diff --git a/src/java/org/mxchange/jfinancials/converter/mobileprovider/FinancialsMobileProviderConverter.java b/src/java/org/mxchange/jfinancials/converter/mobileprovider/FinancialsMobileProviderConverter.java index 845ebab5..4d104a42 100644 --- a/src/java/org/mxchange/jfinancials/converter/mobileprovider/FinancialsMobileProviderConverter.java +++ b/src/java/org/mxchange/jfinancials/converter/mobileprovider/FinancialsMobileProviderConverter.java @@ -44,7 +44,7 @@ public class FinancialsMobileProviderConverter implements Converter { private static MobileProviderSingletonBeanRemote MOBILE_PROVIDER_BEAN; /** - * Initialization of this converter + * Default constructor */ public FinancialsMobileProviderConverter () { } @@ -111,15 +111,15 @@ public class FinancialsMobileProviderConverter 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()); } diff --git a/src/java/org/mxchange/jfinancials/converter/user/FinancialsUserConverter.java b/src/java/org/mxchange/jfinancials/converter/user/FinancialsUserConverter.java index 17c29fa8..1db850b9 100644 --- a/src/java/org/mxchange/jfinancials/converter/user/FinancialsUserConverter.java +++ b/src/java/org/mxchange/jfinancials/converter/user/FinancialsUserConverter.java @@ -43,7 +43,7 @@ public class FinancialsUserConverter implements Converter { private static UserSessionBeanRemote USER_BEAN; /** - * Initialization of this converter + * Default constructor */ public FinancialsUserConverter () { } @@ -99,15 +99,15 @@ public class FinancialsUserConverter 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()); } } diff --git a/src/java/org/mxchange/jfinancials/validator/user/FinancialsUserIdValidator.java b/src/java/org/mxchange/jfinancials/validator/user/FinancialsUserIdValidator.java index 1fbfe2b1..3b5ff90b 100644 --- a/src/java/org/mxchange/jfinancials/validator/user/FinancialsUserIdValidator.java +++ b/src/java/org/mxchange/jfinancials/validator/user/FinancialsUserIdValidator.java @@ -49,7 +49,7 @@ public class FinancialsUserIdValidator extends BaseLongValidator implements Vali private static final long serialVersionUID = 12_869_569_314_764_690L; /** - * Initialization of this converter + * Default constructor */ public FinancialsUserIdValidator () { } -- 2.39.5