KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tc > aspectwerkz > aspect > AdviceType


1 /*
2  * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
3  */

4 package com.tc.aspectwerkz.aspect;
5
6 import java.io.Serializable JavaDoc;
7
8 /**
9  * Type-safe enum for the advice types.
10  *
11  * @author <a HREF="mailto:jboner@codehaus.org">Jonas BonŽr </a>
12  */

13 public class AdviceType implements Serializable JavaDoc {
14
15   public static final AdviceType AROUND = new AdviceType("around");
16   public static final AdviceType BEFORE = new AdviceType("before");
17   public static final AdviceType AFTER = new AdviceType("after");
18   public static final AdviceType AFTER_FINALLY = new AdviceType("afterFinally");
19   public static final AdviceType AFTER_RETURNING = new AdviceType("afterReturning");
20   public static final AdviceType AFTER_THROWING = new AdviceType("afterThrowing");
21
22   private final String JavaDoc m_name;
23
24   private AdviceType(String JavaDoc name) {
25     m_name = name;
26   }
27
28   public String JavaDoc toString() {
29     return m_name;
30   }
31
32   public boolean equals(Object JavaDoc o) {
33     if (this == o) {
34       return true;
35     }
36     if (!(o instanceof AdviceType)) {
37       return false;
38     }
39     final AdviceType adviceType = (AdviceType) o;
40     if ((m_name != null) ? (!m_name.equals(adviceType.m_name)) : (adviceType.m_name != null)) {
41       return false;
42     }
43     return true;
44   }
45
46   public int hashCode() {
47     return ((m_name != null) ? m_name.hashCode() : 0);
48   }
49 }
Popular Tags