|
WebObjects 5.2.3 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.webobjects.foundation.NSValidation.Utility
This class is a convenience that allows you to access the properties of NSValidation objects and non-NSValidation objects using the same code.
Utility's methods are similar to DefaultImplementation's methods in that they are static methods and they take an extra argument -- the object on which the method should operate. However, Utility's methods simply check to see whether the object on which they operate is an NSValidation object and invoke the corresponding NSValidation method on the object if it is. Otherwise, they invoke the corresponding DefaultImplementation method, passing the object on which to operate.
For example, to access an object with the NSValidation API but it is not known if the object is an NSValidation object. To do so, the corresponding Utility API is used , as in the following line of code:
The above line of code is simply a shortcut for the following:theValue = NSValidation.Utility.validateValueForKey(object,value,key);
if (object instanceof NSValidation) { theValue =((NSValidation)object).validateValueForKey(key); } else { theValue =validateValueForKey.DefaultImplementation.validateValueForKey( object,value,key); }
Method Summary | |
static Object |
validateTakeValueForKeyPath(Object object,
Object value,
String keyPath)
If object is an NSValidation, invokes validateTakeValueForKeyPath
on object ; otherwise invokes NSValidation.DefaultImplementation's
validateTakeValueForKeyPath method with object as the object on
which to operate. |
static Object |
validateValueForKey(Object object,
Object value,
String key)
If object is an NSValidation, invokes validateValueForKey on
object ; otherwise invokes NSValidation.DefaultImplementation's
validateValueForKey method with object as the object on which
to operate. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static Object validateTakeValueForKeyPath(Object object, Object value, String keyPath) throws NSValidation.ValidationException
object
is an NSValidation, invokes validateTakeValueForKeyPath
on object
; otherwise invokes NSValidation.DefaultImplementation's
validateTakeValueForKeyPath
method with object
as the object on
which to operate.
object
- object on the destination showed by the keypathvalue
- value corresponding to the keypathkeyPath
- relative path of the method
object
if all the values associated
with it are legal; otherwise, the default object
NSValidation.ValidationException
- value
isn't
legal to NSValidationNSValidation.validateTakeValueForKeyPath(java.lang.Object, java.lang.String)
,
NSValidation.DefaultImplementation
public static Object validateValueForKey(Object object, Object value, String key) throws NSValidation.ValidationException
object
is an NSValidation, invokes validateValueForKey
on
object
; otherwise invokes NSValidation.DefaultImplementation's
validateValueForKey
method with object
as the object on which
to operate.
object
- object on the destination showed by the keypathvalue
- value corresponding to the keypathkey
- property of object
object
if all the values associated
with it are legal; otherwise, the default object
NSValidation.ValidationException
- value isn't
legal to NSValidationNSValidation.validateValueForKey(java.lang.Object, java.lang.String)
,
NSValidation.DefaultImplementation
|
Last updated Thu Oct 21 15:04:16 PDT 2004. | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |