H
Homer
Hi All,
In company I am working we have wide variation of FlatDataFiles and
pretty much what we are doing is process those files and create another
bunch of flat files.
What I've done is past (and present) is to create a class structure for
each file type and put all the fields and functions related to that
file_type inside that class. Class will read the file and give me back
object (either reads the whole file if is small or I pass one record to
class and get back formatted data inside object).
Now I am thinking about why not write only one class that reads
everything based on a XML format_file. Inside XML file I explain what
kind of records and fields I am going to have (format of the file) and
I use the same code for different files.
Now the problem is I can't create a class on fly because
class/variables names can't be dynamic. I am writing a version that
keeps everything inside arraylist but it doesn't look good at all. I
was thinking about opening a file and Write my class inside the file
(fileObj.write("class myclass { .....}"); ), then close it (as
something.java) and compile and link it.
Does any body have any idea if I am going the right way and how to
solve my problem?
Thanks in advance,
Homer
In company I am working we have wide variation of FlatDataFiles and
pretty much what we are doing is process those files and create another
bunch of flat files.
What I've done is past (and present) is to create a class structure for
each file type and put all the fields and functions related to that
file_type inside that class. Class will read the file and give me back
object (either reads the whole file if is small or I pass one record to
class and get back formatted data inside object).
Now I am thinking about why not write only one class that reads
everything based on a XML format_file. Inside XML file I explain what
kind of records and fields I am going to have (format of the file) and
I use the same code for different files.
Now the problem is I can't create a class on fly because
class/variables names can't be dynamic. I am writing a version that
keeps everything inside arraylist but it doesn't look good at all. I
was thinking about opening a file and Write my class inside the file
(fileObj.write("class myclass { .....}"); ), then close it (as
something.java) and compile and link it.
Does any body have any idea if I am going the right way and how to
solve my problem?
Thanks in advance,
Homer