01: /* ***********************************************************************************
02: * Copyright (c) Jonas BonŽr, Alexandre Vasseur. All rights reserved. *
03: * http://aspectwerkz.codehaus.org *
04: * ---------------------------------------------------------------------------------- *
05: * The software in this package is published under the terms of the LGPL license *
06: * a copy of which has been included with this distribution in the license.txt file. *
07: * ************************************************************************************/
08: package org.codehaus.aspectwerkz.aspect;
09:
10: import java.io.Serializable;
11:
12: /**
13: * Type-safe enum for the advice types.
14: *
15: * @author <a href="mailto:jboner@codehaus.org">Jonas BonŽr </a>
16: */
17: public class AdviceType implements Serializable {
18:
19: public static final AdviceType AROUND = new AdviceType("AROUND");
20: public static final AdviceType BEFORE = new AdviceType("BEFORE");
21: public static final AdviceType AFTER = new AdviceType("AFTER");
22: public static final AdviceType AFTER_FINALLY = new AdviceType(
23: "AFTER_FINALLY");
24: public static final AdviceType AFTER_RETURNING = new AdviceType(
25: "AFTER_RETURNING");
26: public static final AdviceType AFTER_THROWING = new AdviceType(
27: "AFTER_THROWING");
28:
29: private final String m_name;
30:
31: private AdviceType(String name) {
32: m_name = name;
33: }
34:
35: public String toString() {
36: return m_name;
37: }
38:
39: public boolean equals(Object o) {
40: if (this == o) {
41: return true;
42: }
43: if (!(o instanceof AdviceType)) {
44: return false;
45: }
46: final AdviceType adviceType = (AdviceType) o;
47: if ((m_name != null) ? (!m_name.equals(adviceType.m_name))
48: : (adviceType.m_name != null)) {
49: return false;
50: }
51: return true;
52: }
53:
54: public int hashCode() {
55: return ((m_name != null) ? m_name.hashCode() : 0);
56: }
57: }
|