com.iparelan.util.annotations.patterns
Annotation Type Singleton


@Documented
@Target(value=TYPE)
@Retention(value=SOURCE)
@Copyright(value="Copyright © 2008, Iparelan Solutions, LLC. All rights reserved.")
public @interface Singleton

Marks a class as implementing the Singleton pattern.

There are several ways to implement the singleton pattern, but all of them strive to prohibit multiple instantiations of the singleton type by implementing an instantiation constraint.

Usually this constraint is implemented by creating only private constructors. However, this constraint cannot be enforced at compile-time in all situations. Some runtime constraint must be employed when a compile-time constraint cannot be specified. Examples are such situations are:

Version:
July 2008
Author:
Greg Mattes
See Also:
"Design Patterns," Erich Gamma, et. al., "Singleton"



Copyright © 2008 Iparelan Solutions, LLC. All rights reserved.