Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@www.apache.org Received: (qmail 76079 invoked from network); 1 Oct 2003 12:50:24 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 1 Oct 2003 12:50:24 -0000 Received: (qmail 72700 invoked by uid 500); 1 Oct 2003 12:50:17 -0000 Delivered-To: apmail-jakarta-commons-dev-archive@jakarta.apache.org Received: (qmail 72651 invoked by uid 500); 1 Oct 2003 12:50:16 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 72637 invoked from network); 1 Oct 2003 12:50:16 -0000 Received: from unknown (HELO main.gmane.org) (80.91.224.249) by daedalus.apache.org with SMTP; 1 Oct 2003 12:50:16 -0000 Received: from root by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 1A4gQq-00042v-00 for ; Wed, 01 Oct 2003 14:50:16 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: commons-dev@jakarta.apache.org Received: from sea.gmane.org ([80.91.224.252]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1A4gKo-0003zj-00 for ; Wed, 01 Oct 2003 14:44:02 +0200 Received: from news by sea.gmane.org with local (Exim 3.35 #1 (Debian)) id 1A4gKo-0008BV-00 for ; Wed, 01 Oct 2003 14:44:02 +0200 From: "Knut Wannheden" Subject: Re: [HiveMind] extend BuildFactory to use static fields/methods Date: Wed, 1 Oct 2003 14:44:01 +0200 Lines: 111 Message-ID: References: X-Complaints-To: usenet@sea.gmane.org X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Sender: news X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N In my case I was simply trying to wrap a hivemind service around an existing service (which is generated code), where accessing a static member is required. But I can of course also write a new interface and class to wrap this. --knut "Johan Lindquist" wrote in message news:oprwc6bzhn5c7tcy@localhost... > I may have misunderstood this - but doesn't hivemind always return the > same instance when you ask for a service once it has created one (unless > it is a threaded service model, when you are worried about state anyway > and probably want different instances)? If so, what is the need to have a > static instance? I suppose I can see a use for it to share data between > threads, but the singleton service should suffice? > > Johan > > On Wed, 01 Oct 2003 13:52:58 +0200, Christian Essl > wrote: > > > That's very good (and fast implemented). But do you realy have to do the > > double-check on the class. I mean the user sees anyway what class it is > > from the JavaDoc and HiveMind will always check that it fits the Service > > interface. > > > > Sure if the static field changes this ensures consistency, but on the > > other hand it would be also very convient to change all services > > referenced but just changing the static field without the need to go > > into the module. > > > > > > On Wed, 1 Oct 2003 12:40:12 +0200, Knut Wannheden > > wrote: > > > >> I have created a copy of the hivemind.BuilderFactory service which > >> allows me > >> to write: > >> > >> > >> > >> > >> > >> 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 > >>> 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): > >>> > > >>> > > >>> > > >>> > > >>> > > >>> > > >>> > > >>> > --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 > >> > > > > > > > > > > -- > you too? --------------------------------------------------------------------- To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-dev-help@jakarta.apache.org