net.xoetrope.xui.validation
Class XValidationFactory

java.lang.Object
  extended by net.xoetrope.xui.validation.XValidationFactory

public class XValidationFactory
extends java.lang.Object

    

Constucts validations be reading rules from a configuration file

Copyright: Copyright (c) Xoetrope Ltd., 1998-2003
License: see license.txt

$Revision: 2.4 $


Field Summary
protected  java.util.Hashtable validations
          Hashtable of validation generated from the file referenced by the 'Validations' property in startup.properties
 
Constructor Summary
XValidationFactory()
          null ctor
XValidationFactory(java.io.Reader reader)
          Constructor which reads validations from the reader
 
Method Summary
 XValidator getValidation(java.lang.String validationName, int mask, java.lang.Object page)
          Gets the validation for the validationName.
 XValidator getValidation(java.lang.String validationName, java.lang.reflect.Method m, int mask, java.lang.Object page, XmlElement pageEle)
          Creates an XValidation object which validates against a value returned from a function call
 void read(java.io.Reader read)
          Loads XmlElements from the file and puts the element into the validations Hashtable with the name of the validation as the key.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

validations

protected java.util.Hashtable validations
Hashtable of validation generated from the file referenced by the 'Validations' property in startup.properties

Constructor Detail

XValidationFactory

public XValidationFactory()
null ctor


XValidationFactory

public XValidationFactory(java.io.Reader reader)
Constructor which reads validations from the reader

Parameters:
reader - Reader of file containing validations
Method Detail

read

public void read(java.io.Reader read)
Loads XmlElements from the file and puts the element into the validations Hashtable with the name of the validation as the key.

Parameters:
read - The Reader object from which the validations will be loaded

getValidation

public XValidator getValidation(java.lang.String validationName,
                                java.lang.reflect.Method m,
                                int mask,
                                java.lang.Object page,
                                XmlElement pageEle)
Creates an XValidation object which validates against a value returned from a function call

Parameters:
validationName - The name of the validation
m - The Method to call in order to get the value to validate against
mask - The event mask to be applied to the validation
page - The page object which contains the function
pageEle - the XML element which is declared in the page
Returns:
The new XValidator

getValidation

public XValidator getValidation(java.lang.String validationName,
                                int mask,
                                java.lang.Object page)
Gets the validation for the validationName. Checks first to see if the validation is a predefined type in which case it reads it's required attributes. If the validation type is custom we just need to create a validator from the class attribute

Parameters:
page - The page object which contains the function
validationName - The name of the validation
mask - The event mask to be applied to the validation
Returns:
The new XValidator