commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Knut Wannheden" <knut.wannhe...@paranor.ch>
Subject Re: [HiveMind] extend BuildFactory to use static fields/methods
Date Wed, 01 Oct 2003 10:40:12 GMT
I have created a copy of the hivemind.BuilderFactory service which allows me
to write:

<invoke-factory service-id="my.BuilderFactory">
 <construct class="foo.Bar" static-field="foo.Bar.INSTANCE"/>
</invoke-factory>

given that I have something like:

package foo;
public interface Bar {
 static final INSTANCE = new BarImpl();
}

The class attribute is used to check that the object specified by the
static-field is of a given type, which is an interface in this example.

--knut

> That's certainly a good idea.
>
> On Wed, 1 Oct 2003 07:50:42 +0200, Knut Wannheden
> <knut.wannheden@paranor.ch> wrote:
>
> > Hi,
> >
> > I was wondering whether it would make sense to extend the BuildFactory
> > service (or maybe add a new wervice) to also be able to construct
objects
> > by
> > returning the value of a classes static field or by calling a static
> > method
> > on a class. The former would obviously be simpler. E.g. (as a new
> > service):
> >
> > <invoke-factory service-id="hivemind.StaticBuilderFactory">
> > <construct class="foo.Bar" static-field="BAZ">
> > <set.../>
> > </construct>
> > </invoke-factory>
> >
> > --knut
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> >
>
>
>
> -- 
> Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/




---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message