net.sf.doolin.gui.validation
Class AbstractValidator<B>

java.lang.Object
  extended by net.sf.doolin.gui.validation.AbstractValidator<B>
Type Parameters:
B - Type of the bean to validate
All Implemented Interfaces:
GUIValidator<B>
Direct Known Subclasses:
ChainedValidator, ConfirmPasswordValidator, SimpleValidator

public abstract class AbstractValidator<B>
extends Object
implements GUIValidator<B>

Abstract validator.

Author:
Damien Coraboeuf

Constructor Summary
AbstractValidator()
           
 
Method Summary
 String getMsgMandatoryKey()
          Gets the msg mandatory key.
protected  void isNotBlank(GUIValidation result, String value, Object key, Object name)
          Checks if is not blank.
protected  void isNotNull(GUIValidation result, Object value, Object key, Object name)
          Checks if is not null.
 void setMsgMandatoryKey(String msgMandatoryKey)
          Sets the msg mandatory key.
 GUIValidation validate(B model)
          Validates the model
protected abstract  void validate(GUIValidation validationResult, B model)
          Validate.
protected  void validate(GUIValidation result, boolean test, Object key, String msgKey, Object... params)
          Validate.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sf.doolin.gui.validation.GUIValidator
subscribe
 

Constructor Detail

AbstractValidator

public AbstractValidator()
Method Detail

validate

public GUIValidation validate(B model)
Validates the model.

Specified by:
validate in interface GUIValidator<B>
Parameters:
model - the bean
Returns:
the validation result

isNotNull

protected void isNotNull(GUIValidation result,
                         Object value,
                         Object key,
                         Object name)
Checks if is not null.

Parameters:
result - the result
value - the value
key - the key
name - the name

isNotBlank

protected void isNotBlank(GUIValidation result,
                          String value,
                          Object key,
                          Object name)
Checks if is not blank.

Parameters:
result - the result
value - the value
key - the key
name - the name

validate

protected void validate(GUIValidation result,
                        boolean test,
                        Object key,
                        String msgKey,
                        Object... params)
Validate.

Parameters:
result - the result
test - the test
key - the key
msgKey - the msg key
params - the params

validate

protected abstract void validate(GUIValidation validationResult,
                                 B model)
Validate.

Parameters:
validationResult - the validation result
model - the model to validate

getMsgMandatoryKey

public String getMsgMandatoryKey()
Gets the msg mandatory key.

Returns:
the msg mandatory key

setMsgMandatoryKey

public void setMsgMandatoryKey(String msgMandatoryKey)
Sets the msg mandatory key.

Parameters:
msgMandatoryKey - the new msg mandatory key


Copyright © 2011. All Rights Reserved.