Got To Believe It's Getting Better
Jun. 17th, 2013 10:30 pmI am gradually figuring out more and more about how to work with Java types, enums, autoboxing, and generics, which is important when you're doing inbound XML serialization, as you end up needing to create a lot of objects. I've written a bunch of little utility routines that keep my XML consistent and the resulting XML document is making successful round trips, which I find very encouraging.
Eventually, I will have written enough utilities to cover all of my current cases. Right now, I'm still at the stage where I go to serialize another class and go, "Whoops! Time to write some more serialization code..."
Eventually, I will have written enough utilities to cover all of my current cases. Right now, I'm still at the stage where I go to serialize another class and go, "Whoops! Time to write some more serialization code..."
Writing It Out
Jun. 12th, 2013 11:52 pmI've now got a mostly-working XML serialization implementation in Java built on top of the StAX API. I have successfully written data out. Tomorrow, I will see if I can read it back in. :)
I know that there will be pieces of this and that which I'll be adding to the implementation for some time as I deal with different types of data. But it's a start...
I know that there will be pieces of this and that which I'll be adding to the implementation for some time as I deal with different types of data. But it's a start...
Send In the Clones
May. 16th, 2013 10:30 pmToday was spent working through the Cloneable interface and creating copy constructors for the various classes I've been working on. Despite various dire warnings that I found via Google about the problems with the Cloneable interface, it appears to be one that we're using around here, so I will just have to use it carefully. :)
In other news, I sent off an e-mail that may result in stress reduction. We'll see how that goes...
In other news, I sent off an e-mail that may result in stress reduction. We'll see how that goes...
As Operation Learn Java In a Week continues, I'm getting behind on several things that I would rather not be behind on.
daisy_knotwise is going out of town to the Women's Drum Weekend that Sally is organizing. Maybe after Katie and Julie go to sleep...
(However, Gretchen advises me that when I'm out of town, the girls never go to sleep. This could be a flaw in my otherwise clever plan.)
(However, Gretchen advises me that when I'm out of town, the girls never go to sleep. This could be a flaw in my otherwise clever plan.)
Generically Yours
May. 13th, 2013 09:55 pmI spent today immersed in Java generics, trying to figure out how to write an abstract base class using generics that would do everything that I wanted it to do. I've coded something up and sent it to one of the fellows in the shop who is a good bit further along with Java coding than I am (since I am at less than a week, that wouldn't be saying a lot, but apparently he's quite good) and we'll see what he has to say about my questions on the subject.
The thing that's causing me the problem is that I'm building a tree of items (in arbitrary order, so it doesn't look like there's anything in the Collection classes that quite does what I need) where each node in the tree has a unique key. Normally, that key is a String and needs to be searched for in a case-insensitive fashion. But in one of the cases where I want to use this generic tree class, the key is going to be a complex object, because when I'm storing time periods, you can't really compare any sort of reasonable human-readable String using a normal String comparison and get the right answer.
I'm trying to code a Find function and pass it my arbitrary generic Key and I'm having a real problem getting it to work. Maybe what I should be doing is actually storing the TreeItems in a Tree and putting a HashMap into the Tree to solve the Find problem. Except right now, I'm storing just one reference to the HashMap in the root object for the Tree.
Of course, if the generic Tree class extends the generic TreeItem class, I could probably get that trick to work... :)
The thing that's causing me the problem is that I'm building a tree of items (in arbitrary order, so it doesn't look like there's anything in the Collection classes that quite does what I need) where each node in the tree has a unique key. Normally, that key is a String and needs to be searched for in a case-insensitive fashion. But in one of the cases where I want to use this generic tree class, the key is going to be a complex object, because when I'm storing time periods, you can't really compare any sort of reasonable human-readable String using a normal String comparison and get the right answer.
I'm trying to code a Find function and pass it my arbitrary generic Key and I'm having a real problem getting it to work. Maybe what I should be doing is actually storing the TreeItems in a Tree and putting a HashMap into the Tree to solve the Find problem. Except right now, I'm storing just one reference to the HashMap in the root object for the Tree.
Of course, if the generic Tree class extends the generic TreeItem class, I could probably get that trick to work... :)