01-08-2010 01:22 PM
I have a class containing configuration settings in the form of String variables like
public static final String IMEI2 = "00460101501594500";
This class contains about 35 different strings like that. And nothing else
These settings are also saved in Runtime storage. Is it possible to code a routine that saves these into Runtime storage without explicity code the names of these variables. Like some kind of "Meta" code that first finds all the names of these variabes in the class and saves the name of the variabl and its value. Similar question is if it is possible to retrieve a value for a specific configuration by its name like something like this "pseudo code"
variableName = "IMEI2";
variablecontent = variableName.content;
01-08-2010 01:35 PM
The only way i know to do what you request is to make a singleton object class. Call the instance of the class with a personalized method get and set. In this class you also create Key constant to you in your set and get method.
01-08-2010 02:32 PM
I think you are looking for reflection - there is no reflection possible in J2ME.
But two quick questions for you to think about.
1) Why do you need to put these in RuntimeStore if they are in your static class?
2) If you wanted to have name value pairs, why didn't you just code your static class in that way in the first place?