net.xoetrope.xui.validation
Interface XValidator

All Known Implementing Classes:
XBaseValidator, XMandatoryValidator, XMinMaxValidator

public interface XValidator

An interface describing a validator. The work of the validator will be done in the validate method. If an error is called then an exception will be thrown. Typically the exception will be caught in a panel class such as XPage. The handleException method of a XValidationExceptionHandler implementation will then be invoked.

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

$Revision: 2.4 $


Field Summary
static int IGNORE_BLANKS
           
static int LEVEL_ERROR
          The validation generated an error
static int LEVEL_IGNORE
          ignore the results of this validation
static int LEVEL_WARNING
          The validation generated a warning
static int MANDATORY
          whether input is mandatory or not
static int STRICT_CHECK
           
static int WEAK_CHECK
           
 
Method Summary
 int getLevel()
          Get the error level of the validations LEVEL_IGNORE = 0 LEVEL_WARNING = 1 LEVEL_ERROR = 2 IGNORE_BLANKS = 1024 MANDATORY = 2048 WEAK_CHECK = 4096 STRICT_CHECK = 8192
 int getMask()
          Get the event mask.
 java.lang.String getMessage()
          Get the validation message which is formatted after the tokens have been replaced
 java.lang.String getName()
          Get the name of the validation
 java.lang.String getValueAsString()
          Get the value as a string object
 void setValidationMethod(java.lang.reflect.Method m, java.lang.Object page)
          Set the Method of the XPage to be invoked when we are doing a funcion validation
 void validate(java.lang.Object c, boolean forceMandatory)
          Carry out a page level or inline validation on the passed component
 

Field Detail

LEVEL_IGNORE

static final int LEVEL_IGNORE
ignore the results of this validation

See Also:
Constant Field Values

LEVEL_WARNING

static final int LEVEL_WARNING
The validation generated a warning

See Also:
Constant Field Values

LEVEL_ERROR

static final int LEVEL_ERROR
The validation generated an error

See Also:
Constant Field Values

IGNORE_BLANKS

static final int IGNORE_BLANKS
See Also:
Constant Field Values

MANDATORY

static final int MANDATORY
whether input is mandatory or not

See Also:
Constant Field Values

WEAK_CHECK

static final int WEAK_CHECK
See Also:
Constant Field Values

STRICT_CHECK

static final int STRICT_CHECK
See Also:
Constant Field Values
Method Detail

validate

void validate(java.lang.Object c,
              boolean forceMandatory)
              throws java.lang.Exception
Carry out a page level or inline validation on the passed component

Parameters:
c - The component whose value is to be validated
forceMandatory - Set to true if page level validations are taking place or false for inline
Throws:
java.lang.Exception - throw if there is a problem

getMask

int getMask()
Get the event mask. The mask helps filter the events for which the validator is invoked

Returns:
the mask

setValidationMethod

void setValidationMethod(java.lang.reflect.Method m,
                         java.lang.Object page)
Set the Method of the XPage to be invoked when we are doing a funcion validation

Parameters:
m - The method to be invoked
page - The XPage which contains the Method.

getName

java.lang.String getName()
Get the name of the validation

Returns:
The name

getMessage

java.lang.String getMessage()
Get the validation message which is formatted after the tokens have been replaced

Returns:
The formatted message.

getValueAsString

java.lang.String getValueAsString()
Get the value as a string object

Returns:
the value as string

getLevel

int getLevel()
Get the error level of the validations
  1. LEVEL_IGNORE = 0
  2. LEVEL_WARNING = 1
  3. LEVEL_ERROR = 2
  4. IGNORE_BLANKS = 1024
  5. MANDATORY = 2048
  6. WEAK_CHECK = 4096
  7. STRICT_CHECK = 8192

Returns:
the error level