com.bankframe.ejb
Class Validator

java.lang.Object
  extended bycom.bankframe.ejb.Validator

public abstract class Validator
extends java.lang.Object


Constructor Summary
Validator()
           
 
Method Summary
 void validate(java.lang.Double data, int errorNumber)
          This method validates a Double for null.
 void validate(java.lang.Integer data, int errorNumber)
          This method validates an Integer for null.
 void validate(java.lang.String data, int errorNumber, int maxDataSize)
          This method validates a piece of data for null and greater than a max length.
 void validateCharacters(java.lang.String data, int errorNumber)
          This method checks if the data contains all characters (A-Z, a-z, and 0-9 ) and is not null.
 void validateDateString(java.lang.String data, int errorNumber)
          This methog validates a String that represents a date.
 void validateDigits(java.lang.String data, int errorNumber)
          This method checks if the data contains all digits and is not null.
 void validateExactLength(java.lang.String data, int errorNumber, int exactSize)
          This method validates if the data is the exact length specified.
 void validateForNull(java.lang.Object data, int errorNumber)
          This method validates that the object is not null.
 void validatePastDateString(java.lang.String data, int errorNumber)
          This method validates that a date string represents a date in the past with respect to the current system date.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Validator

public Validator()
Method Detail

validate

public void validate(java.lang.Double data,
                     int errorNumber)
              throws ValidationException
This method validates a Double for null.

Parameters:
data - Double Data to be validated
errorNumber - errorNumber to be used by ValidationException (if it is thrown)
Throws:
ValidationException - if the object is null

validate

public void validate(java.lang.Integer data,
                     int errorNumber)
              throws ValidationException
This method validates an Integer for null.

Parameters:
data - integer data to be validated
errorNumber - the errorNumber to be used by ValidationException ( if it is thrown )
Throws:
ValidationException - if the object is null

validate

public void validate(java.lang.String data,
                     int errorNumber,
                     int maxDataSize)
              throws ValidationException
This method validates a piece of data for null and greater than a max length.

Parameters:
data - the data to be validated
errorNumber - the errorNumber to be used by ValidationException (if it is thrown)
maxDataSize - the maximum size of the data
Throws:
ValidationException - if the object is null or greater than the max length

validateCharacters

public void validateCharacters(java.lang.String data,
                               int errorNumber)
                        throws ValidationException
This method checks if the data contains all characters (A-Z, a-z, and 0-9 ) and is not null.

Parameters:
data - String Data to be validated
errorNumber - errorNumber to be used by ValidationException ( if it is thrown )
Throws:
ValidationException - if the object is null or is not all characters

validateDateString

public void validateDateString(java.lang.String data,
                               int errorNumber)
                        throws ValidationException
This methog validates a String that represents a date. It should have the format dd/MM/yyyy.

Parameters:
data - String Data to be validated
errorNumber - errorNumber to be used by ValidationException ( if it is thrown )
Throws:
ValidationException - Thrown if the object is null or does not have the correct format

validateDigits

public void validateDigits(java.lang.String data,
                           int errorNumber)
                    throws ValidationException
This method checks if the data contains all digits and is not null.

Parameters:
data - the data to be validated
errorNumber - the errorNumber to be used by ValidationException (if it is thrown)
Throws:
ValidationException - if the object is null or does not contain all digits

validateExactLength

public void validateExactLength(java.lang.String data,
                                int errorNumber,
                                int exactSize)
                         throws ValidationException
This method validates if the data is the exact length specified. If it is not then a ValidationException is thrown.

Parameters:
data - the data to be validated
errorNumber - the errorNumber to be used by ValidationException (if it is thrown)
exactSize - the required length of the String
Throws:
ValidationException - if the object is null or is not the correct length

validateForNull

public void validateForNull(java.lang.Object data,
                            int errorNumber)
                     throws ValidationException
This method validates that the object is not null.

Parameters:
data - the object to be validated
errorNumber - the errorNumber to be used by ValidationException (if it is thrown)
Throws:
ValidationException - if the object is null

validatePastDateString

public void validatePastDateString(java.lang.String data,
                                   int errorNumber)
                            throws ValidationException
This method validates that a date string represents a date in the past with respect to the current system date.

Parameters:
data - the string to be validated
errorNumber - the errorNumber to be used by ValidationException (if it is thrown)
Throws:
ValidationException - if the object is null or the date is not a past date


Copyright © 2005, 2007, Oracle. All rights reserved.