Java->Editor->Templates->New..
Name:Singletone
Description:{whatever}
Pattern should look like:
// *** SIngletone impl
private static class InstanceHolder{
private static ${enclosing_type} instance = new ${enclosing_type}();
}
private ${enclosing_type}() {}
public static ${enclosing_type} getInstance() {
return InstanceHolder.instance;
}
// ***
Now every time you need quick singletone implementation you just type single and ctrl+space...
No comments:
Post a Comment