Chapter 7 Working with Eclipse


Defining .ecore files

EPackage

Tag Name Description Use
Name Package name Package code
NsURI Namespace URI of the package, i.e. the URI that is displayed in the xmlns tag to identify this package in an XMI document Extended Attribute NamespaceURI. The default value is %Code%.xmi
NsPrefix Namespace prefix that is used when references to instances of the classes in this package are serialized Extended Attribute NamespacePrefix.

The default value is %Code%
Prefix Used as the prefix for the names of the generated Factory and Package classes Not supported.

The default value will be the package code
BasePackage Prefix used for the Java package that contains the generated code for the model Not supported.

The base package will be generated in the .genmodel file

EClass

A class will generate an EClass.

Tag Name Description Use
Name Used to construct the names of the generated interface and implementation class Class code
instanceClass Used by the EMF runtime to validate the type of objects Not supported
defaultValue Intrinsic default value for a class. This default will be applied to any attributes of the class Not supported
Abstract If set to True, the generated implementation class will have the abstract keyword Class abstract attribute
interface If set to True, only the java interface will be generated. There will be no corresponding implementation class and no create method in the factory Interface
eSupertypes Super type for this class Parent class of a Generalization

EAttribute

A class attribute will generate an EAttribute.

Tag Name Description Use
Name Name used to construct the names of accessor methods Attribute code
EType Attribute type Attribute data type
changeable Indicates whether the attribute may be modified Attribute Changeability property. Set Changeability to Read Only implies that changeable is set to False
volatile Indicates whether the attribute cannot be cached. If volatile is set to True, the generated class does not contain a field to hold the attribute and the generated get() and set() methods for the attribute are empty Attribute Volatile property
transient Indicates whether the attribute should not be stored Attribute persistent property. Transient is the inverse value of persistent
unique Indicates whether a many-valued attribute is allowed to have duplicates Extended attribute Unique
defaultValueLiteral Determines the value returned by the get method if the attribute has never been set Attribute initial value
lowerBound Determines the setting of the required property. If lowerBound is 0, the required property will be set to False. Otherwise, the required property will be set to True Attribute multiplicity
upperBound Determines the setting of the many property. If upperBound is 1, the many property will be set to False. Otherwise, the many property will be set to True Attribute multiplicity
many If many is set to True, there is no set() method for the attribute and the get() method returns a list that can only contains objects of the appropriate type Not generated. It will be computed from upperBound
required Indicates whether the attribute is required Not generated. It will be computed from LowerBound.
unsettable Indicates that the attribute may be unset Extended attribute Unsettable

EReference

An association will generate an EReference.

Tag Name Description Use
Name Name used to construct the names of accessor methods Opposite role name or association code
eType Reference type Opposite class code
changeable Indicates whether the reference may be modified. If changeable is set to False, no set() method is generated for the reference RoleA or RoleB changeability
volatile Indicates whether the reference cannot be cached. If volatile is set to True, the generated class does not contain a field to hold the reference and the generated get() and set() methods for the reference are empty RoleA or RoleB volatile
transient Indicates whether the reference should not be stored Extended attribute RoleATransient or RoleBTransient.
unique Indicates whether a many-valued attribute is allowed to have duplicates Extended attribute RoleAUnique or RoleBUnique
defaultValue Determines the value returned by the get method if the attribute has never been set Extended attribute RoleADefaultValue or RoleBDefaultValue
lowerBound Determines the setting of the required property Role A or Role B multiplicity
upperBound Determines the setting of the many property Role A or Role B multiplicity
containment Indicates whether the reference is a containment Role A or Role B composition
container Indicates whether the reference is a container. This is the opposite of a containment EReference. If container is true, the generated accessor methods will have container semantics Role A or Role B composition
resolveProxies Indicates whether proxy references should be resolved automatically Extended attribute RoleAResolveProxies or RoleBResolveProxies. The default value is true
eOpposite Identifies the EReference that represents the opposite end of the relationship Computed

EEnum

A class with the stereotype <<enumeration>> will generate an EEnum.

Tag Name Description Use
Name Used to construct the names of the generated interface and implementation class Class code

EEnumLiteral

An attribute defined in a class with the stereotype <<enumeration>> will generate an EEnumLiteral.

Tag Name Description Use
Name Name used to generate the final static constants in the enumeration class that are used to access the literal. Attribute code
value Determines the integer value that is associated with this literal Attribute initial value. The default value is 0

EOperation

An operation will generate an EOperation.

Tag Name Description Use
Name Name of the generated method Operation code
eType Method return type Operation return type

EParameter

An operation parameter will generate an EParameter.

Tag Name Description Use
Name Name of the generated argument Parameter code
EType Argument type Parameter type

EDataType

A Java data type used by an attribute, an operation or a parameter that is not part of the Ecore data types will automatically generate an EDataType.

 


Copyright (C) 2007. Sybase Inc. All rights reserved.