© 2002 BEA Systems, Inc.


examples.e2e.b2b
Class DoubleValueValidator

java.lang.Object
  |
  +--examples.e2e.b2b.DoubleValueValidator

public class DoubleValueValidator
extends java.lang.Object
implements Validator

Validate a String value as a double within a defined range. The string value typically comes from an HTML form. The String value must represent a valid java double number. An expression object (DoubleMinMaxExpression) restricts the numerical values that the double value may take. The allowed value is dictated by the following expression: expression.max() >= value >= expression.min()

See Also:
DoubleMinMaxExpression, Validator

Constructor Summary
DoubleValueValidator()
          Constructs a validator.
 
Method Summary
 java.lang.String validate(ValidatedValues validatedValues, java.lang.String key, java.lang.Object expressionObject, java.lang.String message)
          Validates the String value from the validatedValues object (which is retrieved using the key supplied) as a java double.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DoubleValueValidator

public DoubleValueValidator()
Constructs a validator.
Method Detail

validate

public java.lang.String validate(ValidatedValues validatedValues,
                                 java.lang.String key,
                                 java.lang.Object expressionObject,
                                 java.lang.String message)
Validates the String value from the validatedValues object (which is retrieved using the key supplied) as a java double. The expression object dictates the minimum and maximum values for the double value. The String value obtained from the validatedValues object is trimmed of whitespace using the trim() method of String. See the ValidatedValues documentation for more details on determining the outcome of the validate() method call.
Specified by:
validate in interface Validator

Parameters:
validatedValues - a ValidatedValues object which contains the value to validate.
key - the key to use with the validatedValues object to obtain the string to validate.
expressionObject - an object of type DoubleMinMaxExpression that expresses the minimum and maximum values for the validated value.
message - the message to use if the value fails to validate. If message is null then built-in messages will be used.
Returns:
the trimmed String retrieved from validatedValues via the key.
Throws:
java.lang.RuntimeException - if the expressionObject is not an instance of DoubleMinMaxExpression.

© 2002 BEA Systems, Inc.

Copyright © 2002 BEA Systems, Inc. All Rights Reserved