1 16 package org.jmanage.core.services; 17 18 import org.jmanage.core.util.ErrorCatalog; 19 20 25 public class ServiceException extends RuntimeException { 26 27 private String errorCode; 28 private transient Object [] values; 29 private String message; 30 31 public ServiceException(String errorCode){ 32 this(errorCode, (Object [])null); 33 } 34 35 public ServiceException(String errorCode, Object value0){ 36 this(errorCode, new Object []{value0}); 37 } 38 39 public ServiceException(String errorCode, Object value0, Object value1){ 40 this(errorCode, new Object []{value0, value1}); 41 } 42 43 public ServiceException(String errorCode, Object value0, Object value1, 44 Object value2){ 45 this(errorCode, new Object []{value0, value1, value2}); 46 } 47 48 public ServiceException(String errorCode, Object [] values){ 49 assert errorCode != null; 50 this.errorCode = errorCode; 51 this.values = values; 52 this.message = ErrorCatalog.getMessage(errorCode, values); 53 } 54 55 public String getErrorCode(){ 56 return errorCode; 57 } 58 59 public String getMessage(){ 60 return message; 61 } 62 63 68 public String toString(){ 69 return getMessage(); 70 } 71 } 72 | Popular Tags |