Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Duplicate generated method from extended ecore model
Duplicate generated method from extended ecore model [message #1479767] Wed, 19 November 2014 18:14 Go to next message
Jacob He is currently offline Jacob HeFriend
Messages: 10
Registered: October 2013
Junior Member
I am creating an ASTM model by extending modisco's OMG GASTM model. I define an extended function definition class from GASTM's FunctionDefinition. When I generate the model code, there are several duplicate methods with different return types as follow:

/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public FormalParameterDefinition[] getFormalParameters() {
if (formalParameters == null || formalParameters.isEmpty()) return FORMAL_PARAMETERS_EEMPTY_ARRAY;
BasicEList<FormalParameterDefinition> list = (BasicEList<FormalParameterDefinition>)formalParameters;
list.shrink();
return (FormalParameterDefinition[])list.data();
}

/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<FormalParameterDefinition> getFormalParameters() {
if (formalParameters == null) {
formalParameters = new EObjectContainmentEList<FormalParameterDefinition>(FormalParameterDefinition.class, this, Rpg4Package.IRPG4_PROCEDURE_STATEMENT__FORMAL_PARAMETERS + EOFFSET_CORRECTION);
}
return formalParameters;
}

/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Statement[] getBody() {
if (body == null || body.isEmpty()) return BODY_EEMPTY_ARRAY;
BasicEList<Statement> list = (BasicEList<Statement>)body;
list.shrink();
return (Statement[])list.data();
}

/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<Statement> getBody() {
if (body == null) {
body = new EObjectContainmentEList<Statement>(Statement.class, this, Rpg4Package.IRPG4_PROCEDURE_STATEMENT__BODY + EOFFSET_CORRECTION);
}
return body;
}

I checked the super declarations in class org.eclipse.modisco.omg.gastm.FunctionDefinition, only the methods return EList<?> are defined.

Why does EMF generate the methods return array? How can I make EMF doesn't generate them?
Re: Duplicate generated method from extended ecore model [message #1480398 is a reply to message #1479767] Thu, 20 November 2014 06:33 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Jacob,

It sounds like someone has enabled the GenModel's Model -> Array
Accessors property.

On 19/11/2014 7:14 PM, Jacob He wrote:
> I am creating an ASTM model by extending modisco's OMG GASTM model. I
> define an extended function definition class from GASTM's
> FunctionDefinition. When I generate the model code, there are several
> duplicate methods with different return types as follow:
>
> /**
> * <!-- begin-user-doc -->
> * <!-- end-user-doc -->
> * @generated
> */
> public FormalParameterDefinition[] getFormalParameters() {
> if (formalParameters == null || formalParameters.isEmpty())
> return FORMAL_PARAMETERS_EEMPTY_ARRAY;
> BasicEList<FormalParameterDefinition> list =
> (BasicEList<FormalParameterDefinition>)formalParameters;
> list.shrink();
> return (FormalParameterDefinition[])list.data();
> }
>
> /**
> * <!-- begin-user-doc -->
> * <!-- end-user-doc -->
> * @generated
> */
> public EList<FormalParameterDefinition> getFormalParameters() {
> if (formalParameters == null) {
> formalParameters = new
> EObjectContainmentEList<FormalParameterDefinition>(FormalParameterDefinition.class,
> this, Rpg4Package.IRPG4_PROCEDURE_STATEMENT__FORMAL_PARAMETERS +
> EOFFSET_CORRECTION);
> }
> return formalParameters;
> }
>
> /**
> * <!-- begin-user-doc -->
> * <!-- end-user-doc -->
> * @generated
> */
> public Statement[] getBody() {
> if (body == null || body.isEmpty()) return BODY_EEMPTY_ARRAY;
> BasicEList<Statement> list = (BasicEList<Statement>)body;
> list.shrink();
> return (Statement[])list.data();
> }
>
> /**
> * <!-- begin-user-doc -->
> * <!-- end-user-doc -->
> * @generated
> */
> public EList<Statement> getBody() {
> if (body == null) {
> body = new
> EObjectContainmentEList<Statement>(Statement.class, this,
> Rpg4Package.IRPG4_PROCEDURE_STATEMENT__BODY + EOFFSET_CORRECTION);
> }
> return body;
> }
>
> I checked the super declarations in class
> org.eclipse.modisco.omg.gastm.FunctionDefinition, only the methods
> return EList<?> are defined.
>
> Why does EMF generate the methods return array? How can I make EMF
> doesn't generate them?


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Duplicate generated method from extended ecore model [message #1480807 is a reply to message #1480398] Thu, 20 November 2014 13:55 Go to previous message
Jacob He is currently offline Jacob HeFriend
Messages: 10
Registered: October 2013
Junior Member
Thanks. It works after I disable the property.

Ed Merks wrote on Thu, 20 November 2014 01:33
Jacob,

It sounds like someone has enabled the GenModel's Model -> Array
Accessors property.

On 19/11/2014 7:14 PM, Jacob He wrote:
> I am creating an ASTM model by extending modisco's OMG GASTM model. I
> define an extended function definition class from GASTM's
> FunctionDefinition. When I generate the model code, there are several
> duplicate methods with different return types as follow:
>
> /**
> * <!-- begin-user-doc -->
> * <!-- end-user-doc -->
> * @generated
> */
> public FormalParameterDefinition[] getFormalParameters() {
> if (formalParameters == null || formalParameters.isEmpty())
> return FORMAL_PARAMETERS_EEMPTY_ARRAY;
> BasicEList<FormalParameterDefinition> list =
> (BasicEList<FormalParameterDefinition>)formalParameters;
> list.shrink();
> return (FormalParameterDefinition[])list.data();
> }
>
> /**
> * <!-- begin-user-doc -->
> * <!-- end-user-doc -->
> * @generated
> */
> public EList<FormalParameterDefinition> getFormalParameters() {
> if (formalParameters == null) {
> formalParameters = new
> EObjectContainmentEList<FormalParameterDefinition>(FormalParameterDefinition.class,
> this, Rpg4Package.IRPG4_PROCEDURE_STATEMENT__FORMAL_PARAMETERS +
> EOFFSET_CORRECTION);
> }
> return formalParameters;
> }
>
> /**
> * <!-- begin-user-doc -->
> * <!-- end-user-doc -->
> * @generated
> */
> public Statement[] getBody() {
> if (body == null || body.isEmpty()) return BODY_EEMPTY_ARRAY;
> BasicEList<Statement> list = (BasicEList<Statement>)body;
> list.shrink();
> return (Statement[])list.data();
> }
>
> /**
> * <!-- begin-user-doc -->
> * <!-- end-user-doc -->
> * @generated
> */
> public EList<Statement> getBody() {
> if (body == null) {
> body = new
> EObjectContainmentEList<Statement>(Statement.class, this,
> Rpg4Package.IRPG4_PROCEDURE_STATEMENT__BODY + EOFFSET_CORRECTION);
> }
> return body;
> }
>
> I checked the super declarations in class
> org.eclipse.modisco.omg.gastm.FunctionDefinition, only the methods
> return EList<?> are defined.
>
> Why does EMF generate the methods return array? How can I make EMF
> doesn't generate them?

Previous Topic:(Re)using model elements in other models
Next Topic:Referring to inexistent data member in generated package class
Goto Forum:
  


Current Time: Thu Mar 28 16:59:34 GMT 2024

Powered by FUDForum. Page generated in 0.01968 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top