/*
- * Copyright (C) 2015 Roland Haeder
+ * Copyright (C) 2016, 2017 Roland Häder
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* You also may want to try out some other BaseFooValidator classes before
* directly inheriting from this class.
* <p>
- * @author Roland Haeder<roland@mxchange.org>
+ * @author Roland Häder<roland@mxchange.org>
*/
public abstract class BaseObjectValidator implements Validator, Serializable {
* Needs to be implemented as the Validator interface needs to be
* implemented.
* <p>
- * @param context
- * @param component
- * @param value
+ * @param context FacesContext instance
+ * @param component UIComponent instance
+ * @param value Value to check
* <p>
* @throws ValidatorException
*/
@Override
- abstract public void validate (final FacesContext context, final UIComponent component, final Object value) throws ValidatorException;
+ public abstract void validate (final FacesContext context, final UIComponent component, final Object value) throws ValidatorException;
/**
* The method pre-validates the given value. It makes sure that the
*/
protected 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
+ //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("preValidate: context={0},component={1},value={2},requiredFields={3} - CALLED!", context, component, value, Arrays.toString(requiredFields))); //NOI18N
// Init message and key
FacesMessage facesMessage = null;
// Debug message
//this.getLogger().logDebug(MessageFormat.format("preValidate: isValidField={0}", isValidField)); //NOI18N
+
// Valid field?
if (!isValidField) {
// Invalid field
- facesMessage = new FacesMessage(MessageFormat.format("Valure {0} for clientId={1} is not valid/unexpected.", value, clientId)); //NOI18N
+ facesMessage = new FacesMessage(MessageFormat.format("Value {0} for clientId={1} is not valid/unexpected.", value, clientId)); //NOI18N
}
// Debug message
//this.getLogger().logDebug(MessageFormat.format("preValidate: facesMessage={0}", facesMessage)); //NOI18N
+
// Is it not null?
if (null != facesMessage) {
throw new ValidatorException(facesMessage);
}
// Trace message
- //this.getLogger().logTrace("preValidate: EXIT!"); //NOI18N
+ //* NOISY-DEBUG: */ System.out.println("preValidate: EXIT!"); //NOI18N
}
+
}