Standard Aspects Library

From The Oxygene Language Wiki

Jump to:navigation, search

This is a Language topic
Feel free to add your notes to this topic below.


Delphi Prism comes with a library called RemObjects.Oxygene.StandardAspects, which contains two aspects that users of Delphi Prism can use. Both aspects are defined in the RemObjects.Oxygene.StandardAspects namespace.


CachedAttribute

The Cached attribute can be applied to properties, so their read value will only be evaluated once.

This aspect can only be applied to properties without a write accessor or an implicit field.

The compiler will change the read method to check a private volatile boolean variable. If this variable is false, the current object will be locked and its expression will be evaluated and saved. The volatile boolean will then be set back to true and the expression result will be returned to the caller.


RemObjects.Oxygene.Aspects.Monobjc.ObjectiveCPropertyAttribute

This aspect can be applied to a property to export it to Monobjc-based applications so that it will be usable from a Cocoa GUI.

This aspect can only be applied to properties of classes descending from a Monobjc.Cocoa.NSObject.

The compiler will add the proper Monobjc.ObjectiveCMessageAttribute attributes to the getter and setter methods of the property, so the Cocoa framework will be able to find and call them when needed. The setter method body will be modified by adding calls to the WillChangeValueForKey and DidChangeValueForKey methods. These methods are used by Monobjc to provide notifications when property values are changed.

See the Monobjc documentation for more information about methods involved in the implementation of this attribute.


See Also


Oxygene-48.png

Area: Oxygene Language
Compiler version: Oxygene 5

Language GlossaryKeywordsTypesFAQHow To

Navigation
Areas
More
Toolbox