Nice and clean, and I can't make any examples fail.
Things I couldn't figure out how to test but thought about...
If o2class were a String, but o1class wasn't, we'd be in the second case. I don't see any way for that to happen, but I could be wrong. It would be fine if it did, as long as o2val parses as a long (with an extra java.lang.string.toString()...). It would throw a NumberFormatException if o2val wasn't parseable.
If floats or doubles ever become important, I think they end up in the unparseable NFE case, based on trying parseLong on a float in a string.
Given that it passes all my tests, I don't think it needs to be changed.
Things I couldn't figure out how to test but thought about...
If o2class were a String, but o1class wasn't, we'd be in the second case. I don't see any way for that to happen, but I could be wrong. It would be fine if it did, as long as o2val parses as a long (with an extra java.lang.string.toString()...). It would throw a NumberFormatException if o2val wasn't parseable.
If floats or doubles ever become important, I think they end up in the unparseable NFE case, based on trying parseLong on a float in a string.
Given that it passes all my tests, I don't think it needs to be changed.