commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Vinson <>
Subject Re: [digester] Problems with Custom Rules
Date Wed, 22 Dec 2004 16:15:59 GMT
Hash: SHA1

I actually just finished changing the Custom rule for object creation
to an ObjectCreationFactory.  Works Great!

Thanks for all the feedback.

I love the digester.  :)

Craig McClanahan wrote:

| On Wed, 22 Dec 2004 10:49:00 -0500, Jason Vinson
| <> wrote:

| Hi Carey,
| I implemented it by hand because the object type is determined at
| parse time by the "type" attribute of the entity node.  I am open
| to suggestions of how to approach this more elegantly, since this
| is the first situation I have run into that seems to warrant custom
| rules for pushing objects.
|> The standard ObjectCreateRule allows you to specify the
|> implementation class of the object to create with a "classType"
|> attribute. Alternatively, you might investigate using
|> FactoryCreateRule, which can do pretty much anything you like to
|> decide what kind of object should be created and pushed on to the
|> stack.
| The other Rule seems to work great though...
| As for the addSetNext, I was under the impression that it will pop
| the top of the stack and call the function specified ("add" in this
| case) on the object below it (Which is the ArrayList from the first
| rule). Am I wrong in assuming that?
|> SetNextRule doesn't actually pop the stack.  What it does is call
|> a method on the NEXT to top object on the stack (which is where
|> the "next" part of the name came from), passing the top object on
|> the stack as an argument.  Therefore, you'll want to set up your
|> rules so that the list is pushed first, then each object you want
|> added to the list would be pushed second.
|> The actual popping of the stack doesn't happen until the "end of
|> rule" processing for ObjectCreateRule or FactoryCreateRule.
| Jason
|> Craig
| Nation, Carey wrote:
| | Hi Jason, I haven't done it like that with custom rules and
| pushing | things myself, but doesn't AddSetNext want to have
| instantiated | something itself?  Or actually, doesn't it want a
| rule about | creating the object instance?  I see you're doing that
| by hand in | your code, but I wonder if that's what's confusing
| things? | | Carey | |
| ---------------------------------------------------------------------
|  |  To unsubscribe, e-mail: |
| For additional |
| commands, e-mail: | |

- ---------------------------------------------------------------------
To unsubscribe, e-mail:
For additional commands, e-mail:

| ---------------------------------------------------------------------
|  To unsubscribe, e-mail:
| For additional
| commands, e-mail:

Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using GnuPG with Thunderbird -


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message