com.partnersoft.core
Interface Singleton

All Known Implementing Classes:
AppManager, CogBootstrapSchema, MapsCogSchema, Nad2Nad, XyCogSchema

public interface Singleton

A marker interface for singleton types.

Singletons are one of the many great design patterns described in the book Design Patterns by Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides.

Implementations should provide a single, public static method named singleton() that returns the single instance. They should also declare a private, no-args contructor to prevent instantiation or subtyping.

Be careful of this pattern. It amounts to being a global variable, and can be abused. Having only a single instance can be very inflexible. Generally you should only use this for cases where the singleton guards limited resources (e.g. a serial port or GPS manager) or where there is really no reason why you would want more than one in a virtual machine (e.g. an environment object).

You should NOT use this pattern/interface for classes which can be instantiated, but for which there is some "standard" instance that people should normally use. In those cases, do not declare a singleton() method but instead something with a name like standardInstance() to prevent confusion.

A skeletal implementation is provided in skeletons/SkeletonSingleton.java for your convenience and pleasure.

Copyright 2006 Partner Software, Inc.

Version:
$Id: Singleton.java 1012 2007-11-24 18:30:02Z paul $
Author:
Paul Reavis, Russell Cagle