Couchbase Lite
Objective-C API for iOS and Mac OS
CBLDynamicObject Class Reference

Detailed Description

A generic class with runtime support for dynamic properties.

You can subclass this and declare properties in the subclass without needing to implement them or make instance variables; simply note them as '@dynamic' in the @implementation. The dynamic accessors will be bridged to calls to -getValueOfProperty: and setValue:ofProperty:, allowing you to easily store property values in an NSDictionary or other container.

Inheritance diagram for CBLDynamicObject:
CBLModel

Instance Methods

(id) - getValueOfProperty:
 Returns the value of a named property. More...
 
(BOOL) - setValue:ofProperty:
 Sets the value of a named property. More...
 

Class Methods

(NSSet *) + propertyNames
 Returns the names of all properties defined in this class and superclasses up to CBLDynamicObject. More...
 
(Class) + classOfProperty:
 Given the name of an object-valued property, returns the class of the property's value. More...
 
(NSString *) + getterKey:
 
(NSString *) + setterKey:
 
(IMP) + impForGetterOfProperty:ofClass:
 
(IMP) + impForSetterOfProperty:ofClass:
 
(IMP) + impForGetterOfProperty:ofProtocol:
 
(IMP) + impForSetterOfProperty:ofProtocol:
 
(IMP) + impForGetterOfProperty:ofType:
 
(IMP) + impForSetterOfProperty:ofType:
 

Method Documentation

◆ propertyNames()

+ (NSSet*) propertyNames

Returns the names of all properties defined in this class and superclasses up to CBLDynamicObject.

◆ getValueOfProperty:()

- (id) getValueOfProperty: (NSString *)  property

Returns the value of a named property.

This method will only be called for properties that have been declared in the class's @interface using @property. You must override this method – the base implementation just raises an exception.

Implemented in CBLModel.

◆ setValue:ofProperty:()

- (BOOL) setValue: (id)  value
ofProperty: (NSString *)  property 

Sets the value of a named property.

This method will only be called for properties that have been declared in the class's @interface using @property, and are not declared readonly. You must override this method – the base implementation just raises an exception.

Returns
YES if the property was set, NO if it isn't settable; an exception will be raised. Default implementation returns NO.

◆ classOfProperty:()

+ (Class) classOfProperty: (NSString *)  propertyName

Given the name of an object-valued property, returns the class of the property's value.

Returns nil if the property doesn't exist, or if its type isn't an object pointer or is 'id'.

◆ getterKey:()

+ (NSString*) getterKey: (SEL)  sel

◆ setterKey:()

+ (NSString*) setterKey: (SEL)  sel

◆ impForGetterOfProperty:ofClass:()

+ (IMP) impForGetterOfProperty: (NSString *)  property
ofClass: (Class)  propertyClass 

◆ impForSetterOfProperty:ofClass:()

+ (IMP) impForSetterOfProperty: (NSString *)  property
ofClass: (Class)  propertyClass 

◆ impForGetterOfProperty:ofProtocol:()

+ (IMP) impForGetterOfProperty: (NSString *)  property
ofProtocol: (Protocol *)  propertyProtocol 

◆ impForSetterOfProperty:ofProtocol:()

+ (IMP) impForSetterOfProperty: (NSString *)  property
ofProtocol: (Protocol *)  propertyProtocol 

◆ impForGetterOfProperty:ofType:()

+ (IMP) impForGetterOfProperty: (NSString *)  property
ofType: (const char *)  propertyType 

◆ impForSetterOfProperty:ofType:()

+ (IMP) impForSetterOfProperty: (NSString *)  property
ofType: (const char *)  propertyType 

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