com.threerings.media.tile.tools.xml
Class TileSetRuleSet

java.lang.Object
  extended by org.apache.commons.digester.RuleSetBase
      extended by com.threerings.media.tile.tools.xml.TileSetRuleSet
All Implemented Interfaces:
ValidatedSetNextRule.Validator, org.apache.commons.digester.RuleSet
Direct Known Subclasses:
SwissArmyTileSetRuleSet, UniformTileSetRuleSet

public abstract class TileSetRuleSet
extends org.apache.commons.digester.RuleSetBase
implements ValidatedSetNextRule.Validator

The tileset rule set is used to parse the base attributes of a tileset instance. Derived classes would extend this and add rules for their own special tilesets.


Field Summary
static String TILESET_PATH
          The component of the digester path that is appended by the tileset rule set to match a tileset.
 
Constructor Summary
TileSetRuleSet()
           
 
Method Summary
 void addRuleInstances(org.apache.commons.digester.Digester digester)
          Adds the necessary rules to the digester to parse our tilesets.
 String getPath()
           
 boolean isValid(Object target)
          The ruleset can be provided to a ValidatedSetNextRule to ensure that the tileset was fully parsed before doing something with it.
 void setPrefix(String prefix)
          Instructs the tileset rule set to match tilesets with the supplied prefix.
 
Methods inherited from class org.apache.commons.digester.RuleSetBase
getNamespaceURI
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TILESET_PATH

public static final String TILESET_PATH
The component of the digester path that is appended by the tileset rule set to match a tileset. This is appended to whatever prefix is provided to the tileset rule set to obtain the complete XML path to a matched tileset.

See Also:
Constant Field Values
Constructor Detail

TileSetRuleSet

public TileSetRuleSet()
Method Detail

getPath

public String getPath()
Returns:
The full path used to match tilesets. Consists of the prefile plus _tilesetPath.

setPrefix

public void setPrefix(String prefix)
Instructs the tileset rule set to match tilesets with the supplied prefix. For example, passing a prefix of tilesets.objectsets will match tilesets in the following XML file:
 <tilesets>
   <objectsets>
     <tileset>
       // ...
     </tileset>
   </objectsets>
 </tilesets>
 
This must be called before adding the ruleset to a digester.


addRuleInstances

public void addRuleInstances(org.apache.commons.digester.Digester digester)
Adds the necessary rules to the digester to parse our tilesets. Derived classes should override this method, being sure to call the superclass method and then adding their own rule instances (which should register themselves relative to the _prefix member).

Specified by:
addRuleInstances in interface org.apache.commons.digester.RuleSet
Specified by:
addRuleInstances in class org.apache.commons.digester.RuleSetBase

isValid

public boolean isValid(Object target)
The ruleset can be provided to a ValidatedSetNextRule to ensure that the tileset was fully parsed before doing something with it.

Specified by:
isValid in interface ValidatedSetNextRule.Validator


Copyright © 2011. All Rights Reserved.