Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » How to avoid an EMF Object in XMI serialisation
How to avoid an EMF Object in XMI serialisation [message #993377] Mon, 24 December 2012 07:38 Go to next message
Raghava Rao is currently offline Raghava RaoFriend
Messages: 87
Registered: July 2009
Member
Hello,

I want to avoid an EMF object in XMI serialisation. I can not change the ecore model.

Suppose 'A' is the class in the model.I created a class 'B' by extending 'A'.I should be able to serialise the class 'A' objects.

I should not serialise the class 'B' object during XMI serialisation.

please suggest is there any way to achieve this?

Advance thanks for your reply.

Thanks,
Raghav
Re: How to avoid an EMF Object in XMI serialisation [message #993413 is a reply to message #993377] Mon, 24 December 2012 10:00 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Raghav,

If you don't want certain features serialized, you should make set them
to be transient. You can look at how
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.Lookup.featureKind(EStructuralFeature)
relies on that. In that method, it doesn't know which class was being
considered, so likely you'd need to specialize
org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.Lookup.getFeatures(EClass)
itself to return results to indicate that the feature should be treated
as transient. You can use OPTION_USE_CACHED_LOOKUP_TABLE to specify
your own specialized Lookup class

@SuppressWarnings("unchecked") List<Object> lookup =
(List<Object>)options.get(XMLResource.OPTION_USE_CACHED_LOOKUP_TABLE);
if (lookup != null)
{
// caching turned on by the user
if (lookup.isEmpty())
{
featureTable = new Lookup(map, extendedMetaData, elementHandler);
lookup.add(featureTable);
}
else
{
featureTable = (Lookup)lookup.get(INDEX_LOOKUP);
}
}
else
{
//no caching
featureTable = new Lookup(map, extendedMetaData, elementHandler);
}




On 24/12/2012 8:38 AM, Raghava Rao wrote:
> Hello,
>
> I want to avoid an EMF object in XMI serialisation. I can not change
> the ecore model.
>
> Suppose 'A' is the class in the model.I created a class 'B' by
> extending 'A'.I should be able to serialise the class 'A' objects.
>
> I should not serialise the class 'B' object during XMI serialisation.
>
> please suggest is there any way to achieve this?
>
> Advance thanks for your reply.
>
> Thanks,
> Raghav
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:eInvoke fails
Next Topic:Xcore vs EntityDSL
Goto Forum:
  


Current Time: Thu Apr 25 01:51:46 GMT 2024

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

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

Back to the top