1 16 17 package org.springframework.orm; 18 19 import org.springframework.dao.DataRetrievalFailureException; 20 21 28 public class ObjectRetrievalFailureException extends DataRetrievalFailureException { 29 30 private Object persistentClass; 31 32 private Object identifier; 33 34 35 41 public ObjectRetrievalFailureException(String msg, Throwable cause) { 42 super(msg, cause); 43 } 44 45 51 public ObjectRetrievalFailureException(Class persistentClass, Object identifier) { 52 this(persistentClass, identifier, 53 "Object of class [" + persistentClass.getName() + "] with identifier [" + identifier + "]: not found", 54 null); 55 } 56 57 65 public ObjectRetrievalFailureException( 66 Class persistentClass, Object identifier, String msg, Throwable cause) { 67 68 super(msg, cause); 69 this.persistentClass = persistentClass; 70 this.identifier = identifier; 71 } 72 73 79 public ObjectRetrievalFailureException(String persistentClassName, Object identifier) { 80 this(persistentClassName, identifier, 81 "Object of class [" + persistentClassName + "] with identifier [" + identifier + "]: not found", 82 null); 83 } 84 85 93 public ObjectRetrievalFailureException( 94 String persistentClassName, Object identifier, String msg, Throwable cause) { 95 96 super(msg, cause); 97 this.persistentClass = persistentClassName; 98 this.identifier = identifier; 99 } 100 101 102 106 public Class getPersistentClass() { 107 return (this.persistentClass instanceof Class ? (Class ) this.persistentClass : null); 108 } 109 110 114 public String getPersistentClassName() { 115 if (this.persistentClass instanceof Class ) { 116 return ((Class ) this.persistentClass).getName(); 117 } 118 return (this.persistentClass != null ? this.persistentClass.toString() : null); 119 } 120 121 124 public Object getIdentifier() { 125 return identifier; 126 } 127 128 } 129 | Popular Tags |