Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [Teneo] two small enhancements in SerializableDynamicEObjectImpl
[Teneo] two small enhancements in SerializableDynamicEObjectImpl [message #1702423] Wed, 22 July 2015 09:22 Go to next message
Oleg Orlov is currently offline Oleg OrlovFriend
Messages: 14
Registered: June 2015
Junior Member
Hi all.

The only reason we redefined EMFTuplizer in our project is to support debugging in the IntelliJ Idea. Idea uses entrySet function to inspect contents of maps, so it would be nice to see it implemented in SerializableDynamicEObjectImpl somehow like this:

public Set<Entry<String, Object>> entrySet() {
Set<Entry<String, Object>> result = new LinkedHashSet<>();
for (Object key: keySet()) {
Entry<String, Object> entry = new AbstractMap.SimpleImmutableEntry<String, Object>((String) key, get(key));
result.add(entry);
}
return result;
}

Another small enhancement is to avoid null pointer exception in the get method:

public Object get(Object key) {
EStructuralFeature sf = eClass().getEStructuralFeature((String) key);
if (sf == null)
return null;
return eGet(sf);
}

Thanks.
Re: [Teneo] two small enhancements in SerializableDynamicEObjectImpl [message #1702552 is a reply to message #1702423] Thu, 23 July 2015 07:54 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Oleg,
Looks easy to change, can you file a bugzilla for it? You can combine both in one bugzilla. Also which Teneo version are
you using?

gr. Martin

On 22-07-15 11:22, Oleg Orlov wrote:
> Hi all.
>
> The only reason we redefined EMFTuplizer in our project is to support debugging in the IntelliJ Idea. Idea uses entrySet
> function to inspect contents of maps, so it would be nice to see it implemented in SerializableDynamicEObjectImpl
> somehow like this:
>
> public Set<Entry<String, Object>> entrySet() {
> Set<Entry<String, Object>> result = new LinkedHashSet<>();
> for (Object key: keySet()) {
> Entry<String, Object> entry = new AbstractMap.SimpleImmutableEntry<String, Object>((String) key, get(key));
> result.add(entry);
> }
> return result;
> }
>
> Another small enhancement is to avoid null pointer exception in the get method:
>
> public Object get(Object key) {
> EStructuralFeature sf = eClass().getEStructuralFeature((String) key);
> if (sf == null)
> return null;
> return eGet(sf);
> }
>
> Thanks.
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
Previous Topic:Server throws exception that it is unable to resolve class
Next Topic:[Teneo] possible bug: object references an unsaved transient instance
Goto Forum:
  


Current Time: Sat Feb 29 04:17:44 GMT 2020

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

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

Back to the top