From: Roland Häder Date: Thu, 27 Jul 2017 20:39:58 +0000 (+0200) Subject: Please cherry-pick: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=4e23a2f9aa1e76883e107c12163911cbbfd187fd;p=pizzaservice-war.git 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 Signed-off-by: Roland Häder --- diff --git a/src/java/org/mxchange/pizzaapplication/converter/businesscontact/PizzaBusinessContactConverter.java b/src/java/org/mxchange/pizzaapplication/converter/businesscontact/PizzaBusinessContactConverter.java index 930f55e5..410ab9d4 100644 --- a/src/java/org/mxchange/pizzaapplication/converter/businesscontact/PizzaBusinessContactConverter.java +++ b/src/java/org/mxchange/pizzaapplication/converter/businesscontact/PizzaBusinessContactConverter.java @@ -44,7 +44,7 @@ public class PizzaBusinessContactConverter implements Converter { private static BusinessDataSessionBeanRemote BUSINESS_CONTACT_BEAN; /** - * Initialization of this converter + * Default constructor */ public PizzaBusinessContactConverter () { } @@ -100,15 +100,15 @@ public class PizzaBusinessContactConverter 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/pizzaapplication/converter/contact/PizzaContactConverter.java b/src/java/org/mxchange/pizzaapplication/converter/contact/PizzaContactConverter.java index 37ee533a..945e55af 100644 --- a/src/java/org/mxchange/pizzaapplication/converter/contact/PizzaContactConverter.java +++ b/src/java/org/mxchange/pizzaapplication/converter/contact/PizzaContactConverter.java @@ -43,7 +43,7 @@ public class PizzaContactConverter implements Converter { private static ContactSessionBeanRemote CONTACT_BEAN; /** - * Initialization of this converter + * Default constructor */ public PizzaContactConverter () { } @@ -99,15 +99,15 @@ public class PizzaContactConverter 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/pizzaapplication/converter/country/PizzaCountryConverter.java b/src/java/org/mxchange/pizzaapplication/converter/country/PizzaCountryConverter.java index c8a0faf8..d57413d2 100644 --- a/src/java/org/mxchange/pizzaapplication/converter/country/PizzaCountryConverter.java +++ b/src/java/org/mxchange/pizzaapplication/converter/country/PizzaCountryConverter.java @@ -44,7 +44,7 @@ public class PizzaCountryConverter implements Converter { private static CountrySingletonBeanRemote COUNTRY_BEAN; /** - * Initialization of this converter + * Default constructor */ public PizzaCountryConverter () { } @@ -111,15 +111,15 @@ public class PizzaCountryConverter 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/pizzaapplication/converter/fax/PizzaFaxNumberConverter.java b/src/java/org/mxchange/pizzaapplication/converter/fax/PizzaFaxNumberConverter.java index 40fcd724..7477f2d8 100644 --- a/src/java/org/mxchange/pizzaapplication/converter/fax/PizzaFaxNumberConverter.java +++ b/src/java/org/mxchange/pizzaapplication/converter/fax/PizzaFaxNumberConverter.java @@ -44,7 +44,7 @@ public class PizzaFaxNumberConverter implements Converter { private static PhoneSessionBeanRemote PHONE_BEAN; /** - * Initialization of this converter + * Default constructor */ public PizzaFaxNumberConverter () { } @@ -107,15 +107,15 @@ public class PizzaFaxNumberConverter 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/pizzaapplication/converter/landline/PizzaLandLineNumberConverter.java b/src/java/org/mxchange/pizzaapplication/converter/landline/PizzaLandLineNumberConverter.java index 1ed9af21..7aeccc36 100644 --- a/src/java/org/mxchange/pizzaapplication/converter/landline/PizzaLandLineNumberConverter.java +++ b/src/java/org/mxchange/pizzaapplication/converter/landline/PizzaLandLineNumberConverter.java @@ -44,7 +44,7 @@ public class PizzaLandLineNumberConverter implements Converter { private static PhoneSessionBeanRemote PHONE_BEAN; /** - * Initialization of this converter + * Default constructor */ public PizzaLandLineNumberConverter () { } @@ -100,15 +100,15 @@ public class PizzaLandLineNumberConverter 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/pizzaapplication/converter/mobile/PizzaMobileNumberConverter.java b/src/java/org/mxchange/pizzaapplication/converter/mobile/PizzaMobileNumberConverter.java index 1f7c91de..e686baf5 100644 --- a/src/java/org/mxchange/pizzaapplication/converter/mobile/PizzaMobileNumberConverter.java +++ b/src/java/org/mxchange/pizzaapplication/converter/mobile/PizzaMobileNumberConverter.java @@ -44,7 +44,7 @@ public class PizzaMobileNumberConverter implements Converter { private static PhoneSessionBeanRemote PHONE_BEAN; /** - * Initialization of this converter + * Default constructor */ public PizzaMobileNumberConverter () { } @@ -103,15 +103,15 @@ public class PizzaMobileNumberConverter 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/pizzaapplication/converter/mobileprovider/PizzaMobileProviderConverter.java b/src/java/org/mxchange/pizzaapplication/converter/mobileprovider/PizzaMobileProviderConverter.java index 6661f39b..f0ff4d2f 100644 --- a/src/java/org/mxchange/pizzaapplication/converter/mobileprovider/PizzaMobileProviderConverter.java +++ b/src/java/org/mxchange/pizzaapplication/converter/mobileprovider/PizzaMobileProviderConverter.java @@ -44,7 +44,7 @@ public class PizzaMobileProviderConverter implements Converter { private static MobileProviderSingletonBeanRemote MOBILE_PROVIDER_BEAN; /** - * Initialization of this converter + * Default constructor */ public PizzaMobileProviderConverter () { } @@ -111,15 +111,15 @@ public class PizzaMobileProviderConverter 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/pizzaapplication/converter/user/PizzaUserConverter.java b/src/java/org/mxchange/pizzaapplication/converter/user/PizzaUserConverter.java index 02e828f2..052bb24d 100644 --- a/src/java/org/mxchange/pizzaapplication/converter/user/PizzaUserConverter.java +++ b/src/java/org/mxchange/pizzaapplication/converter/user/PizzaUserConverter.java @@ -43,7 +43,7 @@ public class PizzaUserConverter implements Converter { private static UserSessionBeanRemote USER_BEAN; /** - * Initialization of this converter + * Default constructor */ public PizzaUserConverter () { } @@ -99,15 +99,15 @@ public class PizzaUserConverter 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/pizzaapplication/validator/user/PizzaUserIdValidator.java b/src/java/org/mxchange/pizzaapplication/validator/user/PizzaUserIdValidator.java index 2f453b0a..bb6ac1e1 100644 --- a/src/java/org/mxchange/pizzaapplication/validator/user/PizzaUserIdValidator.java +++ b/src/java/org/mxchange/pizzaapplication/validator/user/PizzaUserIdValidator.java @@ -49,7 +49,7 @@ public class PizzaUserIdValidator extends BaseLongValidator implements Validator private static final long serialVersionUID = 12_869_569_314_764_690L; /** - * Initialization of this converter + * Default constructor */ public PizzaUserIdValidator () { }