examples.e2e.b2b
Class LongValueValidator
java.lang.Object
|
+--examples.e2e.b2b.LongValueValidator
- public class LongValueValidator
- extends java.lang.Object
- implements Validator
Validate a String
value as a long
within
a defined range. The string value typically comes from an HTML form. The
String
value must represent a valid java long
number. An expression object (LongMinMaxExpression
)
restricts the numerical values that the
long
value may take.
The allowed value is dictated by the following expression:
expression.max() >= value >= expression.min()
- See Also:
LongMinMaxExpression
,
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 long . |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
REQUIRED
public static final java.lang.String REQUIRED
NOT_A_NUMBER
public static final java.lang.String NOT_A_NUMBER
BELOW_MIN
public static final java.lang.String BELOW_MIN
ABOVE_MAX
public static final java.lang.String ABOVE_MAX
LongValueValidator
public LongValueValidator()
- Constructs a validator.
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 long
.
The expression object dictates the minimum and maximum values
for the long
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 LongMinMaxExpression
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 LongMinMaxExpression
.
Copyright © 2002 BEA Systems, Inc. All Rights Reserved