Inherits from | |
Conforms to | |
Framework | /System/Library/Frameworks/Foundation.framework |
Availability | Available in Mac OS X v10.0 and later. |
Companion guide | |
Declared in | NSScriptCoercionHandler.h |
Related sample code |
Provides a mechanism for converting one kind of scripting data to another. A shared instance of this class coerces (converts) object values to objects of another class, using information supplied by classes that register with it. Coercions frequently are required during key-value coding.
Returns the shared NSScriptCoercionHandler
for the application.
+ (NSScriptCoercionHandler *)sharedCoercionHandler
The shared NSScriptCoercionHandler
for the application.
NSScriptCoercionHandler.h
Returns an object of a given class representing a given value.
- (id)coerceValue:(id)value toClass:(Class)toClass
The value to coerce.
The class with which to represent value.
An object of the class toClass representing the value specified by value. Returns nil
if an error occurs.
NSScriptCoercionHandler.h
Registers a given object (typically a class) to handle coercions (conversions) from one given class to another.
- (void)registerCoercer:(id)coercer selector:(SEL)selector toConvertFromClass:(Class)fromClass toClass:(Class)toClass
The object that performs the coercion. coercer should typically be a class object.
A selector that specifies the method to perform the coercion. selector should typically be a factory method, and must take two arguments. The first is the value to be converted. The second is the class to convert it to.
The class for which instances are coerced.
The class to which instances of fromClass are coerced.
NSScriptCoercionHandler.h
© 2006 Apple Computer, Inc. All Rights Reserved. (Last updated: 2006-05-23)