KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tc > aspectwerkz > joinpoint > management > JoinPointType


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.joinpoint.management;
5
6 /**
7  * Enumeration for all join point types.
8  *
9  * @author <a HREF="mailto:jboner@codehaus.org">Jonas BonŽr </a>
10  */

11 public final class JoinPointType {
12
13   public static final int METHOD_EXECUTION_INT = 1;
14   public static final int METHOD_CALL_INT = 2;
15   public static final int CONSTRUCTOR_EXECUTION_INT = 3;
16   public static final int CONSTRUCTOR_CALL_INT = 4;
17   public static final int FIELD_SET_INT = 5;
18   public static final int FIELD_GET_INT = 6;
19   public static final int HANDLER_INT = 7;
20   public static final int STATIC_INITIALIZATION_INT = 8;
21
22
23   public static final JoinPointType METHOD_EXECUTION = new JoinPointType(METHOD_EXECUTION_INT);
24
25   public static final JoinPointType METHOD_CALL = new JoinPointType(METHOD_CALL_INT);
26
27   public static final JoinPointType CONSTRUCTOR_EXECUTION = new JoinPointType(CONSTRUCTOR_EXECUTION_INT);
28
29   public static final JoinPointType CONSTRUCTOR_CALL = new JoinPointType(CONSTRUCTOR_CALL_INT);
30
31   public static final JoinPointType FIELD_SET = new JoinPointType(FIELD_SET_INT);
32
33   public static final JoinPointType FIELD_GET = new JoinPointType(FIELD_GET_INT);
34
35   public static final JoinPointType HANDLER = new JoinPointType(HANDLER_INT);
36
37   public static final JoinPointType STATIC_INITIALIZATION = new JoinPointType(STATIC_INITIALIZATION_INT);
38
39   private int m_int;
40
41   private JoinPointType(int asInt) {
42     m_int = asInt;
43   }
44
45   public String JavaDoc toString() {
46     switch (m_int) {
47       case METHOD_EXECUTION_INT:
48         return "MethodExecution";
49       case METHOD_CALL_INT:
50         return "MethodCall";
51       case CONSTRUCTOR_EXECUTION_INT:
52         return "ConstructorExecution";
53       case CONSTRUCTOR_CALL_INT:
54         return "ConstructorCall";
55       case FIELD_GET_INT:
56         return "FieldGet";
57       case FIELD_SET_INT:
58         return "FieldSet";
59       case HANDLER_INT:
60         return "Handler";
61       case STATIC_INITIALIZATION_INT:
62         return "StaticInitialization";
63       default:
64         throw new Error JavaDoc("not supported join point type");
65     }
66   }
67
68   public static JoinPointType fromInt(int asInt) {
69     return new JoinPointType(asInt);
70   }
71
72   public boolean equals(Object JavaDoc o) {
73     if (this == o) return true;
74     if (!(o instanceof JoinPointType)) return false;
75
76     final JoinPointType joinPointType = (JoinPointType) o;
77
78     if (m_int != joinPointType.m_int) return false;
79
80     return true;
81   }
82
83   public int hashCode() {
84     return m_int;
85   }
86 }
Popular Tags