KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jfun > yan > lifecycle > ExceptionPrinter


1 /*****************************************************************************
2  * Copyright (C) Codehaus.org. All rights reserved. *
3  * ------------------------------------------------------------------------- *
4  * The software in this package is published under the terms of the BSD *
5  * style license a copy of which has been included with this distribution in *
6  * the LICENSE.txt file. *
7  *****************************************************************************/

8 /*
9  * Created on Mar 17, 2005
10  *
11  * Author Michelle Lei
12  * ZBS
13  */

14 package jfun.yan.lifecycle;
15
16 /**
17  * Codehaus.org.
18  *
19  * @author Michelle Lei
20  *
21  */

22 final class ExceptionPrinter implements ExceptionHandler {
23   private final java.io.PrintStream JavaDoc out;
24   
25   ExceptionPrinter(final java.io.PrintStream JavaDoc out) {
26     this.out = out;
27   }
28   
29   public void handle(Throwable JavaDoc th) {
30     th.printStackTrace();
31   }
32   public boolean equals(Object JavaDoc obj) {
33     if(obj==this) return true;
34     if(obj instanceof ExceptionPrinter){
35       final ExceptionPrinter eh2 = (ExceptionPrinter)obj;
36       return out.equals(eh2.out);
37     }
38     else return false;
39   }
40   public int hashCode() {
41     return out.hashCode();
42   }
43   public String JavaDoc toString() {
44     return out.toString();
45   }
46 }
47
Popular Tags