Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Y have a createResource(URI) method in XXXPackageImpl
Y have a createResource(URI) method in XXXPackageImpl [message #426238] Sun, 21 December 2008 11:28 Go to next message
Chetan Kumar is currently offline Chetan KumarFriend
Messages: 70
Registered: July 2009
Member
Hi!,

i was just going through the generated PackageImpl and i noticed that
there is a createResource(URI) method that we can override in it. Why have
it here too when we also have the xxxResourceFactory class generated in
the util package ?

I think that the createXYZ() methods are inherited from the package
org.eclipse.emf.ecore.impl.EPackageImpl class. SO, in turn my question is
why have create methods in the generate PackageClass.

cheers,
Chetan Kumar
Re: Y have a createResource(URI) method in XXXPackageImpl [message #426239 is a reply to message #426238] Sun, 21 December 2008 11:44 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30882
Registered: July 2009
Senior Member
Chetan,

Comments below.


Chetan Kumar wrote:
> Hi!,
>
> i was just going through the generated PackageImpl and i noticed that
> there is a createResource(URI) method that we can override in it.
There is a call to that method which is implemented in EPackageImpl
> Why have it here too when we also have the xxxResourceFactory class
> generated in the util package ?
They're not related. A generated EPackage also lives in an Resource so
that you can serialize references to the Ecore model. But that has
nothing to do with the type of resource in which your instances are stored.
>
> I think that the createXYZ() methods are inherited from the package
> org.eclipse.emf.ecore.impl.EPackageImpl class.
Yes.
> SO, in turn my question is why have create methods in the generate
> PackageClass.
There isn't a generated one. There's only a call to a utility method to
create resource for the Ecore model. Typically the only reason to
override it would be to use something other than the EPackage's nsURI as
the Resource's URI, and you'd typically do that only if you want to
serialize an xsi:schemaLocation attribute in your instances (which also
requires using OPTION_SCHEMA_LOCATION when saving the instance).
>
> cheers,
> Chetan Kumar
>
Re: Y have a createResource(URI) method in XXXPackageImpl [message #426240 is a reply to message #426239] Sun, 21 December 2008 13:13 Go to previous message
Chetan Kumar is currently offline Chetan KumarFriend
Messages: 70
Registered: July 2009
Member
Hi Ed,
Thanks for your quick response ... even on a Sunday early morning! U
never really sleep do u ?
comments below:
Ed Merks wrote:

> Chetan,

> Comments below.


> Chetan Kumar wrote:
>> Hi!,
>>
>> i was just going through the generated PackageImpl and i noticed that
>> there is a createResource(URI) method that we can override in it.
> There is a call to that method which is implemented in EPackageImpl
>> Why have it here too when we also have the xxxResourceFactory class
>> generated in the util package ?
> They're not related. A generated EPackage also lives in an Resource so
> that you can serialize references to the Ecore model. But that has
> nothing to do with the type of resource in which your instances are stored.
>>
>> I think that the createXYZ() methods are inherited from the package
>> org.eclipse.emf.ecore.impl.EPackageImpl class.
> Yes.
>> SO, in turn my question is why have create methods in the generate
>> PackageClass.
> There isn't a generated one. There's only a call to a utility method to
> create resource for the Ecore model. Typically the only reason to
> override it would be to use something other than the EPackage's nsURI as
> the Resource's URI, and you'd typically do that only if you want to
> serialize an xsi:schemaLocation attribute in your instances (which also
> requires using OPTION_SCHEMA_LOCATION when saving the instance).
we can also override the create resource in xxxResourceImpl and pass a URI
of my own if i don't want to use the generated URI. Would that give me
same result ?
>>
>> cheers,
>> Chetan Kumar
>>
Previous Topic:Deploying new app using JWS with EMF problems
Next Topic:Update site for M4?
Goto Forum:
  


Current Time: Mon Feb 17 21:13:29 GMT 2020

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

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

Back to the top