The Artima Developer Community
Sponsored Link

Java Buzz Forum
we need Reflection in MIDP

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Marc Logemann

Posts: 594
Nickname: loge
Registered: Sep, 2002

Marc Logemann is founder of www.logentis.de a Java consultancy
we need Reflection in MIDP Posted: Dec 31, 2003 6:21 AM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by Marc Logemann.
Original Post: we need Reflection in MIDP
Feed Title: Marc's Java Blog
Feed URL: http://www.logemann.org/day/index_java.xml
Feed Description: Java related topics for all major areas. So you will see J2ME, J2SE and J2EE issues here.
Latest Java Buzz Posts
Latest Java Buzz Posts by Marc Logemann
Latest Posts From Marc's Java Blog

Advertisement

And we need it fast. There are projects where you can live without reflection at all, but its a nightmare to do Webservice calls from a wireless device without reflection. I am using ksoap for soap calls and of course i need to serialize/deserialize objects.

You end up writing code like this:

public void setProperty(int param, Object obj) { if (param == 0) { clubVorgabe = ((Integer) obj).intValue(); } else if (param == 1) { country = (String) obj; } else if (param == 2) { coursePar = ((Integer) obj).intValue(); } else if (param == 3) { courseRating = ((SoapPrimitive) obj).getName(); [..]

The setProperty method is only the deserialisation part, you will also need a serializer for this object which looks similar. When you have 4 attributes, this is ok, but in my project, i have objects with 30 and more attributes. You cant feel your fingers anymore when you are done with one object.

Plus, we have another problem. Object size does matter in the mobile world. Some phones even have restriction how big an object can be at a maximum on the heap. Can you tell me how i should write slim objects without reflection?

So how about a light implementation of the reflection API, i only need JavaBean Style reflection things like discovering the type and calling methods. I know that this wont be very fast on these devices, but hell, the actual coding practice cant be the end.

Perhaps its time to check the Webservice JSR for mobile devices again, wondering how they do (de)serialisation. Most likely its again up to the user to write code like mentioned above.

Read: we need Reflection in MIDP

Topic: Software Facts and Fallacies Previous Topic   Next Topic Topic: Looking for the 'application' in an application framework

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use