1 16 17 package org.springframework.jdbc.support; 18 19 import org.springframework.dao.DataAccessException; 20 import org.springframework.util.StringUtils; 21 22 34 public class CustomSQLErrorCodesTranslation { 35 36 private String [] errorCodes = new String [0]; 37 38 private Class exceptionClass; 39 40 43 public void setErrorCodes(String [] errorCodes) { 44 this.errorCodes = StringUtils.sortStringArray(errorCodes); 45 } 46 47 50 public String [] getErrorCodes() { 51 return errorCodes; 52 } 53 54 57 public void setExceptionClass(Class exceptionClass) { 58 if (!DataAccessException.class.isAssignableFrom(exceptionClass)) { 59 throw new IllegalArgumentException ("Invalid exception class [" + exceptionClass + 60 "]: needs to be a subclass of [org.springframework.dao.DataAccessException]"); 61 } 62 this.exceptionClass = exceptionClass; 63 } 64 65 68 public Class getExceptionClass() { 69 return exceptionClass; 70 } 71 72 } 73 | Popular Tags |