public abstract class VConditional extends FormValidator
Since the pre/post conditions can be arbitrary, this class defines
abstract methods called preConditionMet(fc.web.forms.FormData, javax.servlet.http.HttpServletRequest)
and postConditionMet(fc.web.forms.FormData, javax.servlet.http.HttpServletRequest)
. If the pre condition is true, the post condition must
also be true. Subclasses should implement both methods as appropriate.
Constructor and Description |
---|
VConditional(Form f,
String name,
String errorMessage) |
Modifier and Type | Method and Description |
---|---|
abstract boolean |
postConditionMet(FormData fd,
javax.servlet.http.HttpServletRequest req)
Subclasses should implement this method to check that
certain post conditions have been met.
|
abstract boolean |
preConditionMet(FormData fd,
javax.servlet.http.HttpServletRequest req)
Subclasses should implement this method to check that certain fields or
pre-conditions have been met.
|
boolean |
validate(FormData fd,
javax.servlet.http.HttpServletRequest req)
Returns the value returned by
postConditionMet(fc.web.forms.FormData, javax.servlet.http.HttpServletRequest)
if the pre conditions were met. |
getErrorMessage, getName, setErrorMessage, toString
public VConditional(Form f, String name, String errorMessage)
public boolean validate(FormData fd, javax.servlet.http.HttpServletRequest req)
postConditionMet(fc.web.forms.FormData, javax.servlet.http.HttpServletRequest)
if the pre conditions were met. (preConditionMet(fc.web.forms.FormData, javax.servlet.http.HttpServletRequest)
returned true). If the pre condition was
not met, there is no need for further validation and
this method will return true.validate
in class FormValidator
public abstract boolean preConditionMet(FormData fd, javax.servlet.http.HttpServletRequest req)
public abstract boolean postConditionMet(FormData fd, javax.servlet.http.HttpServletRequest req)
preConditionMet(fc.web.forms.FormData, javax.servlet.http.HttpServletRequest)
method
returns true.