commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Kitching <>
Subject Re: [digester]: Is there a way to populate bean tags by only onecall
Date Sun, 18 May 2003 23:19:09 GMT
On Fri, 2003-05-16 at 18:24, Norbert Krömeke wrote:
> Hi Simon,
> Thanks for your answer, but haw can I put the "tag-name" and "tag-body" to
> my function "addParam" ?
> Have I any possibility to extract the "tag-name" if I use "<call-param-rule>"?
> Sorry for this naive question, but I am still beginner in this stuff.

Hmm..missed that point.

I think unfortunately you are right; there is no way to pass the tag
name as a parameter when using CallMethodRule/CallParamRule.

It looks like a custom rule would be needed to do what you wish. Writing
a custom Rule isn't too complicated, but as you are using xml rules, you
will also need to write the xml "glue" stuff.

Note Craig's email which suggested an alternative approach: replace your
"setParam(String attrName, String attrValue)" method with a separate
method to set each attribute:
  setTrack1(String value) {...}
  setTrack2(Strign value) {...}
This would be more java-bean-like. I think you could then use the
BeanPropertySetterRule something like this:
  <bean-property-setter pattern="parameters/*"/>
which would match a <track1>foo</track1> tag inside a parameters tag,
and would then invoke


Robert, what do you think about the idea of enhancing CallParamRule so
that the tag name can be passed as a parameter to an invoked method?

Another question for you, Robert: I thought that a feature was addded
fairly recently to make it possible to use CallParamRule to pass an
arbitrary object to a method. However, I can't find that functionality.
This could be used in Norbert's case to at least pass the tag name into
a target method, as follows:
to pass the literal string "foo" as the 0th parameter. If this
functionality doesn't exist, then what do you think about the idea of
adding this too??



View raw message