Path: csiph.com!usenet.pasdenom.info!gegeweb.org!newsfeed.kamp.net!newsfeed.kamp.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Nigel Wade Newsgroups: comp.lang.java.programmer Subject: Re: Wormholes Date: Tue, 04 Sep 2012 17:26:45 +0100 Lines: 24 Message-ID: References: <0ska4895k2mp2j5fb5p4qnue7lsbdpoeoo@4ax.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net 4h+V81k84+WEaWUQLAFJNw6UD0l/W70bafTe7zY0NUAUciZlDREY+DX1ChfqZ1zrSo Cancel-Lock: sha1:aIEsIoxaOtoSI4is1D8mGeQlCgg= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20120421 Thunderbird/12.0 In-Reply-To: <0ska4895k2mp2j5fb5p4qnue7lsbdpoeoo@4ax.com> Xref: csiph.com comp.lang.java.programmer:18539 On 04/09/12 02:12, Roedy Green wrote: > I run into this sort of problem fairly often. > > I have a method x that calls method y through a long chain of > intermediate calls. > > I decide to add a feature. Method x has access to information to > decide if the feature should be implemented. Method y is where the > implementation is. > What about Properties? They might provide a suitably "global" solution without too much coupling. A class with its own internal static Properties variable, and static methods to set/get the properties. Then method x can set any property it likes, and method y can attempt to read any property it likes. Unset properties return null, or a default value if you implement a getProperty(key, default) method. -- Nigel Wade