com.webstersmalley.chessweb.model
Class MoveValidator

java.lang.Object
  extended by com.webstersmalley.chessweb.model.MoveValidator
All Implemented Interfaces:
org.springframework.validation.Validator

public final class MoveValidator
extends java.lang.Object
implements org.springframework.validation.Validator

Validator class for a new move.

Author:
Matthew Smalley

Constructor Summary
MoveValidator()
           
 
Method Summary
 Board getBoard()
           
 void setBoard(Board board)
           
 boolean supports(java.lang.Class clazz)
          Checks which classes are supported by this validator.
 void validate(java.lang.Object command, org.springframework.validation.Errors errors)
          Checks whether the move is valid or not.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MoveValidator

public MoveValidator()
Method Detail

getBoard

public Board getBoard()
Returns:
Returns the board.

setBoard

public void setBoard(Board board)
Parameters:
board - The board to set.

supports

public boolean supports(java.lang.Class clazz)
Checks which classes are supported by this validator. Only Move classes are supported.

Specified by:
supports in interface org.springframework.validation.Validator
Parameters:
clazz - the class to test.
Returns:
whether the class is supported.

validate

public void validate(java.lang.Object command,
                     org.springframework.validation.Errors errors)
Checks whether the move is valid or not.

Specified by:
validate in interface org.springframework.validation.Validator
Parameters:
command - the command object.
errors - the collection of errors.


Copyright © 2005 Webster Smalley. All Rights Reserved.