1 19 package jcckit.util; 20 21 import java.lang.reflect.*; 22 23 29 public class FactoryException extends RuntimeException { 30 private final String _fullKey; 31 private final String _className; 32 private final Object _reason; 33 34 46 public FactoryException(ConfigParameters configParameters, String key, 47 Object reason) { 48 _fullKey = configParameters.getFullKey(key); 49 _className = configParameters.get(key, null); 50 if (reason instanceof InvocationTargetException) { 51 reason = ((InvocationTargetException) reason).getTargetException(); 52 } 53 _reason = reason; 54 } 55 56 57 public String getFullKey() { 58 return _fullKey; 59 } 60 61 62 public String getClassName() { 63 return _className; 64 } 65 66 67 public Object getReason() { 68 return _reason; 69 } 70 71 75 public String toString() { 76 return getClass().getName() + ": " + _fullKey + " = " + _className 77 + ": " + _reason; 78 } 79 } 80 | Popular Tags |