wyvern.lib.properties
Interface SelfExternalizable

All Known Implementing Classes:
AbstractGameMap, AutobagRules, AutoGrab, BasicBag, Body, GuildSkills, ItemList, MovableLightSource, PlayerInventory, PointList, RandomMessages, SpellListImpl, StringList, Talker, TavernMenu, Weight

public interface SelfExternalizable

This interface tells the system that the object wants to manage the reading and writing of its property list.

Version:
1.0, Feb 15, 1998
Author:
Steve Yegge

Method Summary
 void readData(org.w3c.dom.Node bean)
          Tells the object to parse its externalized representation from a list of lines.
 boolean shouldWrite()
          Allows the object to determine whether it wants to be written out at all.
 java.util.List writeData()
          Tells the object to write its properties out to a text file.
 

Method Detail

readData

public void readData(org.w3c.dom.Node bean)
              throws java.lang.Exception
Tells the object to parse its externalized representation from a list of lines.

Parameters:
bean - the XML DOM representation of the externalized bean object. Its child could be a text node, in which case the bean has to do all the parsing for the data. It could also wrap a series of elements (e.g. archetypes), in which case the bean may wish to leverage the XML parsing utilities that the game provides in the ArchetypeManager.

Throws:
java.lang.Exception

writeData

public java.util.List writeData()
                         throws java.lang.Exception
Tells the object to write its properties out to a text file.

Returns:
a list of lines to be written to the text file, formatted appropriately. The lines include everything except the and tags, which are constructed and written automatically.
Throws:
java.lang.Exception

shouldWrite

public boolean shouldWrite()
Allows the object to determine whether it wants to be written out at all. If the object determines that it's the equivalent of a null value (e.g. an item list with no items in it), it can return false and it won't go into the output file.

Returns:
true to write the object, false to skip it