commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Gardner" <gardne...@gmail.com>
Subject [betwixt] Partial bean support?
Date Sat, 01 Apr 2006 04:27:33 GMT
Does betwixt support reading or writing partial beans? I have a large-ish
hierarchy of beans, and I would like to send only those properties that have
changed. For example, say I have the following:

public class Game {
    public void addPlayer(Player p) {...}
    public Collection<Player> getPlayers() {...}
    ...
}

I send an instance of Game with two Players through a BeanWriter, which
writes them out and assigns the Game an id of (say) 42. Later on, I add a
third Player to the Game, and I would like to re-send the Game with XML to
the effect of:

<game idref="42">
    <players>
        <player>...</player>
    </players>
</game>

When a BeanReader tries to reconstruct this, it would look up with its
IdStoringStrategy the existing Game for id 42, and then call 'addPlayer' on
that object with the newly-constructed Player object as the argument.

Note that while one of my reasons for wanting to do this is bandwidth usage,
I have other reasons for wanting betwixt to re-use the existing Game instead
of constructing a new one.

Can betwixt do anything like this? (I fear not.)

If not, how much work would it be for me to add such capabilities myself?
Are there any other ways to accomplish this?

Michael

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message