java - Set Object name from String -
i have create objects using reflection, facing problem how set name of instance specified in string e.g. string contains:
new instancename java.util.arraylist
where instancename refers new instance of arraylist, know how create object through reflection cannot figure out way assign specific name instance string. help? in advance.
the name of variable references created object not define object, , can't assigned during runtime. create "name" referece object, , can use object later through "script" (the strings mention), need implement yourself.
one way have map<string, object>, add name , points value (of map) object every time create new object (when processing strings example). problem approach if never delete map entries, object never freed memory garbage collector. fix that, should have way in "script" tell when free object created.
Comments
Post a Comment