01: /*
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */
04: package com.tc.aspectwerkz.joinpoint.management;
05:
06: /**
07: * Enumeration for all join point types.
08: *
09: * @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: public static final JoinPointType METHOD_EXECUTION = new JoinPointType(
23: METHOD_EXECUTION_INT);
24:
25: public static final JoinPointType METHOD_CALL = new JoinPointType(
26: METHOD_CALL_INT);
27:
28: public static final JoinPointType CONSTRUCTOR_EXECUTION = new JoinPointType(
29: CONSTRUCTOR_EXECUTION_INT);
30:
31: public static final JoinPointType CONSTRUCTOR_CALL = new JoinPointType(
32: CONSTRUCTOR_CALL_INT);
33:
34: public static final JoinPointType FIELD_SET = new JoinPointType(
35: FIELD_SET_INT);
36:
37: public static final JoinPointType FIELD_GET = new JoinPointType(
38: FIELD_GET_INT);
39:
40: public static final JoinPointType HANDLER = new JoinPointType(
41: HANDLER_INT);
42:
43: public static final JoinPointType STATIC_INITIALIZATION = new JoinPointType(
44: STATIC_INITIALIZATION_INT);
45:
46: private int m_int;
47:
48: private JoinPointType(int asInt) {
49: m_int = asInt;
50: }
51:
52: public String toString() {
53: switch (m_int) {
54: case METHOD_EXECUTION_INT:
55: return "MethodExecution";
56: case METHOD_CALL_INT:
57: return "MethodCall";
58: case CONSTRUCTOR_EXECUTION_INT:
59: return "ConstructorExecution";
60: case CONSTRUCTOR_CALL_INT:
61: return "ConstructorCall";
62: case FIELD_GET_INT:
63: return "FieldGet";
64: case FIELD_SET_INT:
65: return "FieldSet";
66: case HANDLER_INT:
67: return "Handler";
68: case STATIC_INITIALIZATION_INT:
69: return "StaticInitialization";
70: default:
71: throw new Error("not supported join point type");
72: }
73: }
74:
75: public static JoinPointType fromInt(int asInt) {
76: return new JoinPointType(asInt);
77: }
78:
79: public boolean equals(Object o) {
80: if (this == o)
81: return true;
82: if (!(o instanceof JoinPointType))
83: return false;
84:
85: final JoinPointType joinPointType = (JoinPointType) o;
86:
87: if (m_int != joinPointType.m_int)
88: return false;
89:
90: return true;
91: }
92:
93: public int hashCode() {
94: return m_int;
95: }
96: }
|