ObjFW
Instance Methods | List of all members
<OFKeyValueCoding> Protocol Reference

A protocol for Key Value Coding. More...

#import <ObjFW/OFKeyValueCoding.h>

Inherited by OFObject(KeyValueCoding).

Instance Methods

(nullable id) - valueForKey:
 Returns the value for the specified key. More...
 
(nullable id) - valueForUndefinedKey:
 This is called by valueForKey: if the specified key does not exist. More...
 
(void) - setValue:forKey:
 Set the value for the specified key. More...
 
(void) - setValue:forUndefinedKey:
 This is called by setValue:forKey: if the specified key does not exist. More...
 
(void) - setNilValueForKey:
 This is called by setValue:forKey: if the specified key is a scalar, but the value specified is nil. More...
 

Detailed Description

A protocol for Key Value Coding.

Key Value Coding makes it possible to access properties dynamically using the interface described by this protocol.

Method Documentation

◆ setNilValueForKey:()

- (void) setNilValueForKey: (OFString *)  key

This is called by setValue:forKey: if the specified key is a scalar, but the value specified is nil.

By default, this throws an OFInvalidArgumentException.

Parameters
keyThe key for which the value nil was specified

◆ setValue:forKey:()

- (void) setValue: (id)  value
forKey: (OFString *)  key 

Set the value for the specified key.

Parameters
valueThe value for the specified key
keyThe key of the value to set

◆ setValue:forUndefinedKey:()

- (void) setValue: (nullable id)  value
forUndefinedKey: (OFString *)  key 

This is called by setValue:forKey: if the specified key does not exist.

By default, this throws an OFUndefinedKeyException.

Parameters
valueThe value for the specified undefined key
keyThe undefined key of the value to set

◆ valueForKey:()

- (nullable id) valueForKey: (OFString *)  key

Returns the value for the specified key.

Parameters
keyThe key of the value to return
Returns
The value for the specified key

◆ valueForUndefinedKey:()

- (nullable id) valueForUndefinedKey: (OFString *)  key

This is called by valueForKey: if the specified key does not exist.

By default, this throws an OFUndefinedKeyException.

Parameters
keyThe undefined key of the value to return
Returns
The value for the specified undefined key

The documentation for this protocol was generated from the following file: