O'Reilly logo

Professional Cairngorm™ by Jeremy Wischusen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required