S
Sideswipe
I have a situation where I have several different input formats that
ultimately need to construct a List<Map<String,Object>> and at some
point I will need to write out the same datatype as well. Classic
serialization.
The input source could be a proprietary formatted config file, XML, a
Database, and so on.
I have in my mind that somehow implementing the Serializable interface
on my own subclasses of List an Map (implementing the writeObject()
and readObject()) respectively is what I am looking for.
Problem is though, it wants me to write to a stream -- in the case of
files, this isn't a problem but in the case of a Database it seems a
stretch to refer to a DB connection as some kinda stream (although not
an impossible stretch). And, I can't control what stream is passed to
those methods
Perhaps the better way would be to implement my own In/Out stream for
the different sources, and if it's and object of form List<map>, then
write out approrpriately. Then again, the writeInt/etc doesn't make
sense in the case of a DB because it is keyed. Only writeObject/
ReadObject has real meaning and only if it's the form I need
So, in summary: I need to load data from multiple sources and
reconstitute an object, then at some point turn it around and write it
back out.
I am looking for some ideas on this -- I would like to use the built
in Java facilities to do it
Christian Bongiorno
http://christian.bongiorno.org
ultimately need to construct a List<Map<String,Object>> and at some
point I will need to write out the same datatype as well. Classic
serialization.
The input source could be a proprietary formatted config file, XML, a
Database, and so on.
I have in my mind that somehow implementing the Serializable interface
on my own subclasses of List an Map (implementing the writeObject()
and readObject()) respectively is what I am looking for.
Problem is though, it wants me to write to a stream -- in the case of
files, this isn't a problem but in the case of a Database it seems a
stretch to refer to a DB connection as some kinda stream (although not
an impossible stretch). And, I can't control what stream is passed to
those methods
Perhaps the better way would be to implement my own In/Out stream for
the different sources, and if it's and object of form List<map>, then
write out approrpriately. Then again, the writeInt/etc doesn't make
sense in the case of a DB because it is keyed. Only writeObject/
ReadObject has real meaning and only if it's the form I need
So, in summary: I need to load data from multiple sources and
reconstitute an object, then at some point turn it around and write it
back out.
I am looking for some ideas on this -- I would like to use the built
in Java facilities to do it
Christian Bongiorno
http://christian.bongiorno.org