ETReflection class documentation

Authors

Eric Wasylishen (ewasylishen@gmail.com)
Mirror-based reflection for Etoile

Copyright: (C) 2009 Eric Wasylishen


Contents -

  1. Software documentation for the ETReflection class
  2. Software documentation for the ETClassMirror protocol
  3. Software documentation for the ETInstanceVariableMirror protocol
  4. Software documentation for the ETMethodMirror protocol
  5. Software documentation for the ETMirror protocol
  6. Software documentation for the ETObjectMirror protocol
  7. Software documentation for the ETProtocolMirror protocol
  8. ETReflection functions

Software documentation for the ETReflection class

ETReflection : NSObject

Declared in:
ETReflection.h

@group Reflection

Method summary

reflectAllRootClasses 

+ (NSArray*) reflectAllRootClasses;
Description forthcoming.

reflectClass: 

+ (id<ETClassMirror>) reflectClass: (Class)aClass;
Description forthcoming.

reflectClassWithName: 

+ (id<ETClassMirror>) reflectClassWithName: (NSString*)className;
Description forthcoming.

reflectObject: 

+ (id<ETObjectMirror>) reflectObject: (id)anObject;
Description forthcoming.

reflectProtocol: 

+ (id<ETProtocolMirror>) reflectProtocol: (Protocol*)aProtocol;
Description forthcoming.

reflectProtocolWithName: 

+ (id<ETProtocolMirror>) reflectProtocolWithName: (NSString*)protocolName;
Description forthcoming.

Software documentation for the ETClassMirror protocol

ETClassMirror

Declared in:
ETReflection.h
Conforms to:
ETMirror
ETCollection

@group Reflection

Method summary

adoptedProtocolMirrors 

- (NSArray*) adoptedProtocolMirrors;

Returns those protocols explicitly adopted by this class.


allAdoptedProtocolMirrors 

- (NSArray*) allAdoptedProtocolMirrors;

Returns all protocols adopted by this class, including those adopted by means of class inheritance and by protocol inheritance.


allInstanceVariableMirrors 

- (NSArray*) allInstanceVariableMirrors;
Description forthcoming.

allInstanceVariableMirrorsWithOwnerMirror: 

- (NSArray*) allInstanceVariableMirrorsWithOwnerMirror: (id<ETMirror>)aMirror;
Description forthcoming.

allMethodMirrors 

- (NSArray*) allMethodMirrors;
Description forthcoming.

allSubclassMirrors 

- (NSArray*) allSubclassMirrors;
Description forthcoming.

instanceVariableMirrors 

- (NSArray*) instanceVariableMirrors;
Description forthcoming.

instanceVariableMirrorsWithOwnerMirror: 

- (NSArray*) instanceVariableMirrorsWithOwnerMirror: (id<ETMirror>)aMirror;
Description forthcoming.

isMetaClass 

- (BOOL) isMetaClass;
Description forthcoming.

methodMirrors 

- (NSArray*) methodMirrors;
Description forthcoming.

subclassMirrors 

- (NSArray*) subclassMirrors;
Description forthcoming.

superclassMirror 

- (id<ETClassMirror>) superclassMirror;
Description forthcoming.

Software documentation for the ETInstanceVariableMirror protocol

ETInstanceVariableMirror

Declared in:
ETReflection.h
Conforms to:
ETMirror

@group Reflection

Software documentation for the ETMethodMirror protocol

ETMethodMirror

Declared in:
ETReflection.h
Conforms to:
ETMirror

@group Reflection

Method summary

isClassMethod 

- (BOOL) isClassMethod;
Description forthcoming.

Software documentation for the ETMirror protocol

ETMirror

Declared in:
ETReflection.h
Conforms to:
NSObject

@group Reflection

Method summary

name 

- (NSString*) name;
Description forthcoming.

type 

- (ETUTI*) type;
Description forthcoming.

Software documentation for the ETObjectMirror protocol

ETObjectMirror

Declared in:
ETReflection.h
Conforms to:
ETMirror
ETCollection

@group Reflection

Method summary

allInstanceVariableMirrors 

- (NSArray*) allInstanceVariableMirrors;
Description forthcoming.

allMethodMirrors 

- (NSArray*) allMethodMirrors;
Description forthcoming.

allSlotMirrors 

- (NSArray*) allSlotMirrors;
Description forthcoming.

classMirror 

- (id<ETClassMirror>) classMirror;
Description forthcoming.

instanceVariableMirrors 

- (NSArray*) instanceVariableMirrors;
Description forthcoming.

isPrototype 

- (BOOL) isPrototype;
Description forthcoming.

methodMirrors 

- (NSArray*) methodMirrors;
Description forthcoming.

prototypeMirror 

- (id<ETObjectMirror>) prototypeMirror;
Description forthcoming.

representedObject 

- (id) representedObject;
Description forthcoming.

slotMirrors 

- (NSArray*) slotMirrors;
Description forthcoming.

superclassMirror 

- (id<ETClassMirror>) superclassMirror;
Description forthcoming.

Software documentation for the ETProtocolMirror protocol

ETProtocolMirror

Declared in:
ETReflection.h
Conforms to:
ETMirror
ETCollection

@group Reflection

Method summary

allAncestorProtocolMirrors 

- (NSArray*) allAncestorProtocolMirrors;
Description forthcoming.

allMethodMirrors 

- (NSArray*) allMethodMirrors;
Description forthcoming.

ancestorProtocolMirrors 

- (NSArray*) ancestorProtocolMirrors;
Description forthcoming.

methodMirrors 

- (NSArray*) methodMirrors;
Description forthcoming.

ETReflection functions

ETGetInstanceVariableValueForKey

BOOL ETGetInstanceVariableValueForKey(id object, id* value, NSString* key);

Returns the value into the object instance variable by looking it up with the Key Value Coding semantics based on the key, and returns YES on success.

For a key equal to 'variable', Key Value Coding search pattern to access instance variables happens in the order below:

Valid values are all the supported Key Value Coding types such as id, float or NSRect boxed in a NSValue etc.

If no matching instance variable is found, returns NO. Which means that either the key is invalid or the declared ivar type is not supported by Key Value Coding.

This function won't invoke -[NSObject valueForUndefinedKey:].
To implement these extra Key Value Coding behaviors, check whether NO is returned (to call -valueForUndefinedKey:).


ETSetInstanceVariableValueForKey

BOOL ETSetInstanceVariableValueForKey(id object, id value, NSString* key);

Sets the value into the object instance variable by looking it up with the Key Value Coding semantics based on the key, and returns YES on success.

For a key equal to 'variable', Key Value Coding search pattern to access instance variables happens in the order below:

Valid values are all the supported Key Value Coding types such as id, float or NSRect boxed in a NSValue etc.

If no matching instance variable is found, returns NO. Which means that either the key is invalid or the declared ivar type is not supported by Key Value Coding.

This function won't invoke -[NSObject setValue:forUndefinedKey:] and -[NSObject setNilValueForKey:].
To implement these extra Key Value Coding behaviors, check nil and NSNull value before calling this function (to call -setNilValueForKey:), and check whether NO is returned (to call -setValue:forUndefinedKey:).