Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Reset instances of a class and initialize again.

 
Tejeshwar Reddy
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have an XML which i am using as a source for initializing a class in my project.

During the course of execution of the project I am creating instances of this class and making use of them. However I have one module where we can edit the contents of that source XML and save it. So after the saving of the XML, I am looking to reset the instances of the class which were created before and initialize them again with the new data from the XML.

This sounds like a basic question, but i am unable to figure out on how to reset instances of a class and initialize them again. Would be great if I can get some help on this.

Thanks.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How did you initialize them at the first place ? Using reflection ? Using a constructor with parameters ?
 
Tejeshwar Reddy
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Christophe Verré wrote:How did you initialize them at the first place ? Using reflection ? Using a constructor with parameters ?


I have used a constructor to initialize them.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you make a public method which initializes the instance variables, you can call it again to reinitialize your variables.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic