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

15.2. Value Objects

The registration process is centered on the idea of a user. You are collecting data related to a particular user for the purpose of creating an account. This collection of data will be represented by a value object class called UserVO.

The users table has the following columns:

  • userId

  • firstName

  • lastName

  • userName

  • password

  • accessLevel

These columns represent the data that needs to be represented by the UserVO. Recall that aside from representing related data within your application, value objects are also used to transfer data to and from the server. Hence, the properties of the value object should match those of the properties used to represent the object on the server side (in this case database column names).

In the com.FlexBlog.valueobjects package create the UserVO class as follows:

package com.FlexBlog.valueobjects
{
    public class UserVO
    {
        public var userId:int;
        public var firstName:String;
        public var lastName:String;
        public var userName:String;
        public var password:String;
        public var accessLevel:int;
    }
}

You also know that you intend to display messages to the user and that these messages can be either indications of success or notifications that something went wrong. You are going to want the user to be able to distinguish between a success message and an error message. A simple way of doing this is to display success messages in one color and error messages in another. A notification can be said to consist of both the actual message and the type of message ...

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