-
Notifications
You must be signed in to change notification settings - Fork 44
@Singleton
peichhorn edited this page Jun 30, 2012
·
1 revision
More documentation than a serious boilerplate buster.
import lombok.Singleton
@Singleton
public class SingletonEnumExample {
private String s;
public void bar() {
}
}
@Singleton(style=Singleton.Style.HOLDER)
public class SingletonHolderExample {
private String s;
public void foo() {
}
}
public enum SingletonEnumExample {
INSTANCE;
public static SingletonEnumExample getInstance() {
return INSTANCE;
}
private String s;
public void bar() {
}
}
public class SingletonHolderExample {
private static class SingletonHolderExampleHolder {
private static final SingletonHolderExample INSTANCE = new SingletonHolderExample();
}
public static SingletonHolderExample getInstance() {
return SingletonHolderExampleHolder.INSTANCE;
}
private String s;
public void foo() {
}
}
(Documentation pending)
Nothing to configure yet.
I am not able to run @Action. If I provide Action1 implementation it works.
implementation private static Action1 println() { return new Action1() { public void apply(final Object o) { System.out.println(o); } };
pom : com.github.peichhorn lombok-pg 0.11.3
<dependency>
<groupId>com.github.peichhorn</groupId>
<artifactId>lombok-pg</artifactId>
<version>0.11.3</version>
<classifier>runtime</classifier>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.24</version>
<scope>provided</scope>
</dependency>