|
Groovy Documentation | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT |
java.lang.Object groovy.lang.Singleton
@Retention(RetentionPolicy.SOURCE) @Target({ElementType.TYPE}) @GroovyASTTransformationClass("org.codehaus.groovy.transform.SingletonASTTransformation") public @interface Singleton
Class annotation to make class singleton. Singleton can be initialized in static initialization of the class or lazily (on first access) To make singleton lazy it is enough to use @Singleton(lazy=true) Lazy singletons implemented with double check locking and volatile field
Optional Element Summary | |
---|---|
boolean |
lazy
@default false
|
java.lang.String |
property
@default "instance"
|
Method Summary |
---|
Methods inherited from class java.lang.Object | |
---|---|
java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Element Detail |
---|
public boolean lazy
public java.lang.String property
Groovy Documentation