I have a singleton class, ORMHelper, which needs a parameter(FileReader) only on the first time of its instantiation.
ORMHelper.getInstance(FileReader fr);
When this is done the singleton parses the file and does its stuff. Subsequent instantiations don't need the FileReader as the parsing is already done.
ORMHelper.getInstance();
There is a check in the getInstance() to figure out if the file has already been parsed and it throws up an exception otherwise.
Is there a better way to do this?
Aucun commentaire:
Enregistrer un commentaire