object marshalled and unmarshalled

To marshall an object is to convert it into a form suitable for serialised storage or transmission; that is, to convert it from its native form within the JVM’s memory, into a form that could be sent down a wire, inserted into a file/database, etc. The specifics will vary depending on the form of marshalling involved; Java’s default serialisation mechanism is one way, but converting the object into an XML or JSON representation are equally valid.

Unmarshalling is just the reverse/other side of this process; taking a representation of the object created by marshalling, and using it to reconstitute an object instance within the JVM.


I’m not sure exactly what you mean by the other part of your question, to be honest. The original object is typically not changed by marshalling (which is conceptually a read-only operation, like taking a copy). So it’s hashcode, etc., would remain unchanged.

An unmarshalled copy of the object will by definition have the same logical state as the original object (that’s the point of the marshalling after all, to be able to reproduce an equivalent object). So in that respect its state, i.e. the values of its fields, is the same. However, if the hashcode depends on environmental factors – such as the hostname of the machine, or the memory address where the instance is stored – then it might of course report something different. This is particularly relevant with the default Object.hashCode() implementation, whereby the memory location of an object matters. (But then this is not related to marshalling; taking a “perfect copy” of an object within the same JVM by any means would still lead to a different hashcode in this case.)

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)