X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2Forg%2Fmxchange%2Fjcoreee%2Fvalidator%2FBaseObjectValidator.java;h=2114b9b00ecb2f453c94821ca423379ccd5c1418;hb=ee9f85947083a505f0c795d3e769503662758656;hp=a8bd8fcab8cc22a622bfd47e990be4631b9be13a;hpb=fd43529ea3b787833e594371eeac3f70b56bc9e9;p=jcoreee.git diff --git a/src/org/mxchange/jcoreee/validator/BaseObjectValidator.java b/src/org/mxchange/jcoreee/validator/BaseObjectValidator.java index a8bd8fc..2114b9b 100644 --- a/src/org/mxchange/jcoreee/validator/BaseObjectValidator.java +++ b/src/org/mxchange/jcoreee/validator/BaseObjectValidator.java @@ -16,13 +16,13 @@ */ package org.mxchange.jcoreee.validator; +import java.io.Serializable; import java.text.MessageFormat; import javax.faces.application.FacesMessage; import javax.faces.component.UIComponent; import javax.faces.context.FacesContext; import javax.faces.validator.Validator; import javax.faces.validator.ValidatorException; -import org.mxchange.jcoreee.BaseEeSystem; /** * A general object validation class. Please implement @@ -32,7 +32,7 @@ import org.mxchange.jcoreee.BaseEeSystem; *
* @author Roland Haeder
* @throws ValidatorException
*/
@Override
@@ -61,6 +62,7 @@ public abstract class BaseObjectValidator extends BaseEeSystem implements Valida
* @param component UIComponent instance
* @param value Value to check
* @param requiredFields Array of required field names (ending with)
+ *
* @throws ValidatorException If something more horrible went wrong
*/
protected void preValidate (final FacesContext context, final UIComponent component, final Object value, final String[] requiredFields) throws ValidatorException {
@@ -69,7 +71,6 @@ public abstract class BaseObjectValidator extends BaseEeSystem implements Valida
// Init message and key
FacesMessage facesMessage = null;
- String errKey = "ERROR_UNKNOWN_ID"; //NOI18N
// Get client id
final String clientId = component.getClientId();
@@ -89,11 +90,8 @@ public abstract class BaseObjectValidator extends BaseEeSystem implements Valida
// Is it null?
if (null == value) {
- // Generate message
- errKey = String.format("ERROR_%s_IS_NULL", field.toUpperCase()); //NOI18N
-
// Value it null
- facesMessage = new FacesMessage(this.getMessageFromKey(errKey));
+ facesMessage = new FacesMessage(MessageFormat.format("Field {0} is null.", field)); //NOI18N
}
// Abort here
@@ -106,7 +104,7 @@ public abstract class BaseObjectValidator extends BaseEeSystem implements Valida
// Valid field?
if (!isValidField) {
// Invalid field
- facesMessage = new FacesMessage(MessageFormat.format(this.getMessageFromKey(errKey), clientId));
+ facesMessage = new FacesMessage(MessageFormat.format("Valure {0} for clientId={1} is not valid/unexpected.", value, clientId)); //NOI18N
}
// Debug message