X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2Forg%2Fmxchange%2Fjcoreee%2Fvalidator%2Fnumber%2FBaseLongValidator.java;h=b5475d09e10fa59b53b6d2c710c3036fb4383bd1;hb=55c52749914ad50c736e4ace7f2e11595ba5b5c1;hp=c0f737ea88e166b3c6f0df8f1ec1ecd243ef0d2a;hpb=46078dfd03b2c23bc5c44f79bb10498bc21420d3;p=jcoreee.git diff --git a/src/org/mxchange/jcoreee/validator/number/BaseLongValidator.java b/src/org/mxchange/jcoreee/validator/number/BaseLongValidator.java index c0f737e..b5475d0 100644 --- a/src/org/mxchange/jcoreee/validator/number/BaseLongValidator.java +++ b/src/org/mxchange/jcoreee/validator/number/BaseLongValidator.java @@ -16,6 +16,7 @@ */ package org.mxchange.jcoreee.validator.number; +import java.text.MessageFormat; import javax.faces.application.FacesMessage; import javax.faces.component.UIComponent; import javax.faces.context.FacesContext; @@ -25,7 +26,7 @@ import org.mxchange.jcoreee.validator.BaseObjectValidator; /** * A general number value validator. - * + *

* @author Roland Haeder */ public abstract class BaseLongValidator extends BaseObjectValidator implements Validator { @@ -36,12 +37,12 @@ public abstract class BaseLongValidator extends BaseObjectValidator implements V private static final long serialVersionUID = 25_481_878_590_589_321L; @Override - public void preValidate (final FacesContext context, final UIComponent component, final Object value, final String[] requiredFields) throws ValidatorException { + public void preValidate (final FacesContext context, final UIComponent component, final Object value, final String[] requiredFields, boolean allowNull) throws ValidatorException { // Trace message //this.getLogger().logTrace(MessageFormat.format("preValidate: context={0},component={1},value={2},requiredFields={3} - CALLED!", context, component, value, Arrays.toString(requiredFields))); //NOI18N // Pre-validate - super.preValidate(context, component, value, requiredFields); + super.preValidate(context, component, value, requiredFields, allowNull); // Get client id and init message + key String clientId = component.getClientId(); @@ -58,7 +59,7 @@ public abstract class BaseLongValidator extends BaseObjectValidator implements V // Compare value's type if (!(value instanceof Long)) { // Generate message - requiredMessage = this.getMessageStringFromKey(String.format("ERROR_%s_IS_NOT_LONG", field.toUpperCase())); + requiredMessage = MessageFormat.format("Field {0} is not Long.", field); //NOI18N // Value is not right type facesMessage = new FacesMessage(FacesMessage.SEVERITY_ERROR, requiredMessage, requiredMessage); //NOI18N @@ -71,7 +72,7 @@ public abstract class BaseLongValidator extends BaseObjectValidator implements V // Is the number below zero? if (num < 0) { // Generate message - requiredMessage = this.getMessageStringFromKey(String.format("ERROR_%s_IS_BELOW_ZERO", field.toUpperCase())); + requiredMessage = MessageFormat.format("Value {0} for field {1} is below zero.", num, field); //NOI18N // Abort processing here facesMessage = new FacesMessage(FacesMessage.SEVERITY_ERROR, requiredMessage, requiredMessage);