Oracle ADF Model and Business Components API Reference 10.1.2 B14022-01

oracle.jbo.server
Class JboPrecisionScaleValidator

java.lang.Object
  extended byoracle.jbo.server.JboPrecisionScaleValidator
All Implemented Interfaces:
java.util.EventListener, JbiValidator, VetoableChangeListener

public class JboPrecisionScaleValidator
extends java.lang.Object
implements JbiValidator

Implements precision and scale validation for numeric attributes and length validation for string and character attributes. The framework applies this validator to Entity Object attributes whose definitions inlcude XML metadata precision or scale values.

This validator is invoked by an Entity Objects's validate() method when an attribute with defined precision or scale is modified.


Field Summary
static int DEFAULT_SCALE
           
protected  java.lang.Object mLValue
          Temporarily store the value being validated for precision and/or scale.
 
Constructor Summary
JboPrecisionScaleValidator()
          Creates a default validator.
 
Method Summary
 java.lang.String getDescription()
          Gets the description of this validator.
 int getPrecision()
          Gets the precision value.
 int getScale()
          Gets the scale value.
 void setDescription(java.lang.String description)
          Sets the description of this validator.
 void setPrecision(int prec)
          Sets the precision value.
 void setScale(int scale)
          Sets the scale value.
 java.lang.String toString()
          Internal: Applications should not use this method.
 boolean validateValue(java.lang.Object value)
          Tests the Entity Object against this validator's precision and scale values.
 void vetoableChange(PropertyChangeEvent evObj)
          Validates an Entity Object by invoking validateValue().
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

mLValue

protected transient java.lang.Object mLValue
Temporarily store the value being validated for precision and/or scale.


DEFAULT_SCALE

public static final int DEFAULT_SCALE
See Also:
Constant Field Values
Constructor Detail

JboPrecisionScaleValidator

public JboPrecisionScaleValidator()
Creates a default validator.

Use setPrecision and setScale to configure the validatior.

Method Detail

vetoableChange

public void vetoableChange(PropertyChangeEvent evObj)
                    throws JboException
Validates an Entity Object by invoking validateValue().

Specified by:
vetoableChange in interface VetoableChangeListener
Parameters:
evObj - an event object indicating the Entity Object to be validated.
Throws:
AttrSetValException - if validation fails.
JboException

validateValue

public boolean validateValue(java.lang.Object value)
Tests the Entity Object against this validator's precision and scale values.

The precision value is the maximum allowed number of digits in a number, or the number of characters in a string. The scale value, when less than zero, is the minimum number of digits following the decimal point, and when greater than zero, is the minimum number of digits preceeding the decimal point.

Specified by:
validateValue in interface JbiValidator
Parameters:
value - the Entity Object to be tested.
Returns:
true if value is valid.

getPrecision

public int getPrecision()
Gets the precision value. For strings, "precision" refers to length.

Returns:
the precision value.

getScale

public int getScale()
Gets the scale value. If scale validation is not to be performed this value is -127.


setPrecision

public void setPrecision(int prec)
Sets the precision value. For strings, "precision" refers to length.

Parameters:
prec - the new precision value.

setScale

public void setScale(int scale)
Sets the scale value. If scale validation is not to be performed this value should be -127.


toString

public java.lang.String toString()
Internal: Applications should not use this method.


getDescription

public java.lang.String getDescription()
Gets the description of this validator.

Specified by:
getDescription in interface JbiValidator
Returns:
a documentation string.

setDescription

public void setDescription(java.lang.String description)
Sets the description of this validator.

Specified by:
setDescription in interface JbiValidator
Parameters:
description - a documentation string.

Oracle ADF Model and Business Components API Reference 10.1.2 B14022-01

 

Copyright © 1997, 2004, Oracle. All rights reserved.