Advertisement
hocikto19

CrewNotSelectedException factory example

Apr 20th, 2015
461
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.52 KB | None | 0 0
  1. public class CrewNotSelectedException extends Exception{
  2.    
  3.     private final String message;
  4.     private static CrewNotSelectedException instance;
  5.  
  6.     public static CrewNotSelectedException factory(){
  7.         if(instance==null){
  8.             instance=new CrewNotSelectedException();
  9.         }
  10.         return instance;
  11.     }
  12.    
  13.     private CrewNotSelectedException() {
  14.         this.message = "Nevybratý člen posádky";
  15.     }
  16.    
  17.     @Override
  18.     public String getMessage(){
  19.         return message;
  20.     }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement