9.2. What Do They Look Like?
The interfaces associated with value objects are contained in the com.adobe.cairngorm.vo package. The following interfaces are contained in this package:
IValueObject: The IValueObject interface is a marker interface that improves the readability of code by identifying the classes within a Cairngorm application that are to be used as value objects for passing data between tiers of an application.
ValueObject: Deprecated as of Cairngorm 2.1 and replaced by com.adobe.cairngorm.vo.IValueObject.
The code for the IValueObject interface is as follows:
package com.adobe.cairngorm.vo { public interface IValueObject { } }
Much like the IModelLocator interface, the IValueObject interface exists simply to mark a class as a value object. Again, since the interface does not define any methods, it is not always implemented in practice.
Value objects consist of collections of related public properties. A simple value object might look as follows:
package valueObjects { [Bindable] public class UserVO { public var firstName:String; public var lastName:String; public function UserVO() { } } }
An example of a value object that uses the RemoteClass metadata tag can be seen in the ProductVO of the Cairngorm store application:
package com.adobe.cairngorm.samples.store.vo { import com.adobe.cairngorm.vo.IValueObject; import com.adobe.cairngorm.samples.store.util.Comparable; [RemoteClass(alias="com.adobe.cairngorm.samples.store.vo.ProductVO")] public class ProductVO implements ...
Get Professional Cairngorm™ now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.