Thibstars

IntelliJ Singleton Template

Jan 9th, 2016
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.48 KB | None | 0 0
  1. #if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME};#end
  2. #parse("File Header.java")
  3. public final class ${NAME}{
  4.     private static ${NAME} classInstance = new ${NAME}();
  5.  
  6.     private ${NAME}() {
  7.         //Constructor not publicly available
  8.     }
  9.  
  10.     public static synchronized ${NAME} getInstance() {
  11.         return classInstance;
  12.     }  
  13.    
  14.     @Override
  15.     protected Object clone() throws CloneNotSupportedException {
  16.         return super.clone();
  17.     }
  18. }
Add Comment
Please, Sign In to add comment