[Teneo] two small enhancements in SerializableDynamicEObjectImpl [message #1702423] |
Wed, 22 July 2015 05:22  |
Eclipse User |
|
|
|
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 03:54  |
Eclipse User |
|
|
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.27471 seconds