On 26 August 2010 11:29, James Carman <[email protected]> wrote: > This way, you could do: > > Person p = SerializableUtils.deserialize(bytes); > > No casting! Now, if the bytes don't represent a Person object, then > you'll get a ClassCastException, but that's exactly the same thing > that would happen if you did this (with the current API): > > Person p = (Person)SerializableUtils.deserialize(bytes); > > So, we make it easier to use the API by avoiding a cast. I add this "auto-cast" behaviour to some of my classes too. Its a useful technique to handle annoying cases. However, the alternative: Person p = SerializableUtils.deserialize(Person.class, bytes); is more widely used.
Stephen --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
