|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface NestableRuleSet
Used to define rule sets that can be nested within other rule sets. For example, say you have a "scene" object definition like so:
(Note that in the examples square brackets are used instead of angle brackets to simplify my life when composing the documentation.)
[scene name="Foo" version=5] [/scene]This scene is extended with some auxiliary data defined by libraries which can parse and generate XML for their auxiliary objects:
[scene sceneId=1 name="Foo" version=5]
[spot]
[portal portalId=1 x=1 y=1 targetSceneId=2/]
[portal portalId=2 x=15 y=3 targetSceneId=3/]
[portal portalId=3 x=9 y=6 targetSceneId=4/]
[/spot]
[miso]
[object tileId=878172 x=4 y=13 action="cluck"/]
[object tileId=123843 x=18 y=23 action="bark"/]
[/miso]
[/scene]
The spot and miso services can define nestable rule sets which will be
handed to the scene services who will instruct them to add their rule
instances with a prefix of scene.spot and
scene.miso respectively. They then happily parse their
auxiliary objects without knowing that they have been nested inside
some larger structure.
The nestable ruleset should then leave a single object on the digester stack that the enclosing entity can grab.
This isn't proper use of XML, but it solves the problem at hand in an easily extensible manner.
| Method Summary | |
|---|---|
void |
addRuleInstances(String prefix,
org.apache.commons.digester.Digester digester)
Instructs this ruleset to add its rules such that it parses its object from the specified path prefix. |
String |
getOuterElement()
Returns the name of the nested object's outer element so that the parent parser can use it to compose the total path prefix. |
| Method Detail |
|---|
String getOuterElement()
void addRuleInstances(String prefix,
org.apache.commons.digester.Digester digester)
getOuterElement() will have been included in the path
prefix.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||