|
Re: How to avoid an EMF Object in XMI serialisation [message #993413 is a reply to message #993377] |
Mon, 24 December 2012 10:00 |
Ed Merks 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/
|
|
|
Powered by
FUDForum. Page generated in 0.02528 seconds