1 16 package org.apache.commons.lang; 17 18 import java.io.PrintStream ; 19 import java.io.PrintWriter ; 20 21 import org.apache.commons.lang.exception.Nestable; 22 import org.apache.commons.lang.exception.NestableDelegate; 23 24 51 public class NotImplementedException 52 extends UnsupportedOperationException implements Nestable { 53 54 57 private NestableDelegate delegate = new NestableDelegate(this); 58 59 63 private Throwable cause; 64 65 71 public NotImplementedException() { 72 super("Code is not implemented"); 73 } 74 75 81 public NotImplementedException(String msg) { 82 super(msg == null ? "Code is not implemented" : msg); 83 } 84 85 92 public NotImplementedException(Throwable cause) { 93 super("Code is not implemented"); 94 this.cause = cause; 95 } 96 97 105 public NotImplementedException(String msg, Throwable cause) { 106 super(msg == null ? "Code is not implemented" : msg); 107 this.cause = cause; 108 } 109 110 116 public NotImplementedException(Class clazz) { 117 super((clazz == null ? 118 "Code is not implemented" : 119 "Code is not implemented in " + clazz)); 120 } 121 122 129 public Throwable getCause() { 130 return cause; 131 } 132 133 139 public String getMessage() { 140 if (super.getMessage() != null) { 141 return super.getMessage(); 142 } else if (cause != null) { 143 return cause.toString(); 144 } else { 145 return null; 146 } 147 } 148 149 160 public String getMessage(int index) { 161 if (index == 0) { 162 return super.getMessage(); 163 } else { 164 return delegate.getMessage(index); 165 } 166 } 167 168 176 public String [] getMessages() { 177 return delegate.getMessages(); 178 } 179 180 189 public Throwable getThrowable(int index) { 190 return delegate.getThrowable(index); 191 } 192 193 200 public int getThrowableCount() { 201 return delegate.getThrowableCount(); 202 } 203 204 212 public Throwable [] getThrowables() { 213 return delegate.getThrowables(); 214 } 215 216 225 public int indexOfThrowable(Class type) { 226 return delegate.indexOfThrowable(type, 0); 227 } 228 229 241 public int indexOfThrowable(Class type, int fromIndex) { 242 return delegate.indexOfThrowable(type, fromIndex); 243 } 244 245 251 public void printStackTrace() { 252 delegate.printStackTrace(); 253 } 254 255 262 public void printStackTrace(PrintStream out) { 263 delegate.printStackTrace(out); 264 } 265 266 273 public void printStackTrace(PrintWriter out) { 274 delegate.printStackTrace(out); 275 } 276 277 284 public final void printPartialStackTrace(PrintWriter out) { 285 super.printStackTrace(out); 286 } 287 288 } 289 | Popular Tags |