Dave, On 6/21/05, David J. M. Karlsen <[EMAIL PROTECTED]> wrote: > Knut Wannheden wrote: > > Is the object (of class A) you want to create a service implementation > > or a configuration contribution? > it's a service. > > > > In either case you will have to define a schema using a combination of > > <create-object> rules and an <invoke-parent method="addCommand"/> rule > > to add the command to the A object. Note that the <create-object> rule > > requires a public no-arg constructor. > hmm, that's no good. I have to add arguments to the constructor. > is it possible to set properties on the object created from > <create-object> ? If so, I could move them from the constructor to set'ers. >
Yes, you can either use a lightweight initialization string in the <create-object> rule itself or use additional <read-attribute>, <read-content>, and <set-property> rules. The BuilderFactory doesn't support invoking arbitrary methods on the constructed object, so you will unfortunately have to implement your own service implementation factory. Depending on the features you need in your service implementation factory this can be more or less complicated. Autowiring is probably the most complicated feature to support. In that case you should probably look into extending the BuilderFactory's schema and reusing the BuilderFactoryLogic code. If you OTOH don't need anything that fancy you could possibly even let the schema rules handle most of the construction for you. You can also provide your own schema processing rules using the <custom> rule. With this approach your service implementation factory could be as simple as a single return statement (i.e. returning the parameter). --knut --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
