|
Non-static Peers (was: Torque 4.0 plan): msg#00025jakarta.turbine.torque.devel
Oops, I used the swear word "singleton" ... Fortunately, I probably misused it. I did not mean to enforce singleton behaviour, i.e. to forbid the existence of more than one instance. The static wrapper would be for ease of usage, the Backend class for those which do not want to use static method at all, and for the people in between, a setter to exchange the backend of the static class. I have appended some sample code. Would this be ok ? Any better suggestions ? Thomas The code would look as follows: public class SomePeer { private static SomePeerBackend backend; static { backend = new SomePeerBackend(); } public static void setBackend(SomePeerBackend backend) { if (backend == null) { throw new NullPointerException(); } this.backend = backend; } public static List doSelect(Criteria criteria) { return backend.doSelect(criteria); } .... } public class SomePeerBackend { /** Public constructor */ public SomePeerBackend() { } public List doSelect(Criteria criteria) { // do select, return results ... } ... } On Fri, 1 Dec 2006, Joe Carter wrote: On 30/11/06, Henning P. Schmiedehausen <hps@xxxxxxxxxxxx> wrote: |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | [Db-torque Wiki] Update of "NextRelease" by ThomasFischer: 00025, Apache Wiki |
|---|---|
| Next by Date: | Re: Primitives or not: 00025, Thomas Fischer |
| Previous by Thread: | Re: Torque 4.0 plani: 00025, Joe Carter |
| Next by Thread: | Re: Non-static Peers (was: Torque 4.0 plan): 00025, Joe Carter |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |