If you really want to know, you'd have to look at the source code of XMLEncoder. You'll be able to find the source code in the file
src.zip in your JDK installation directory.
However, why are you so interested to know why it does this? All that's important for you when you use XMLEncoder is that it does what its documentation says it does. How exactly it does that shouldn't bother you. Also, how it exactly works is not specified anywhere, and in a different version of
Java it might work differently. Maybe in some future version of Java the implementation is changed and it will call your getter method only once, or maybe three times, or any other number of times. It doesn't matter, as long as XMLEncoder does what its documentation says it does.
Getter methods should be
idempotent (they should return the same result every time you call them and not have any side effects), so it shouldn't matter how often XMLEncoder calls them.