Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint

10.2. Attributes

As described previously, the generated interface and implementation class that correspond to an EClass include one or more accessor methods for each EAttribute that the EClass contains. The number and nature of these accessors depend on the type of the attribute, as defined by the EAttribute’s eType, as well as the values of several of the EAttribute’s own attributes. They specify whether an attribute can contain multiple values, what the default value of the attribute will be, whether to provide storage for the attribute’s value, whether it can be changed, and whether it can be unset. The following subsections describe how these settings affect the generated code patterns.

10.2.1. Simple Attributes

We describe an attribute as simple when it is single-valued and its type is an Ecore-defined data type that corresponds to a basic Java language type like int, boolean, or String.[1] Our purchase order example includes several simple attributes. Let’s look at the comment attribute in class PurchaseOrder, which is illustrated in Figure 10.3.

[1] These types are modeled in Ecore by EInt, EBoolean, and EString, respectively.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial