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: **************************************************************************************/package org.codehaus.aspectwerkz.joinpoint.management;
08:
09: /**
10: * Enumeration for all join point types.
11: *
12: * @author <a href="mailto:jboner@codehaus.org">Jonas BonŽr </a>
13: */
14: public final class JoinPointType {
15:
16: public static final int METHOD_EXECUTION_INT = 1;
17: public static final int METHOD_CALL_INT = 2;
18: public static final int CONSTRUCTOR_EXECUTION_INT = 3;
19: public static final int CONSTRUCTOR_CALL_INT = 4;
20: public static final int FIELD_SET_INT = 5;
21: public static final int FIELD_GET_INT = 6;
22: public static final int HANDLER_INT = 7;
23: public static final int STATIC_INITIALIZATION_INT = 8;
24:
25: public static final JoinPointType METHOD_EXECUTION = new JoinPointType(
26: METHOD_EXECUTION_INT);
27:
28: public static final JoinPointType METHOD_CALL = new JoinPointType(
29: METHOD_CALL_INT);
30:
31: public static final JoinPointType CONSTRUCTOR_EXECUTION = new JoinPointType(
32: CONSTRUCTOR_EXECUTION_INT);
33:
34: public static final JoinPointType CONSTRUCTOR_CALL = new JoinPointType(
35: CONSTRUCTOR_CALL_INT);
36:
37: public static final JoinPointType FIELD_SET = new JoinPointType(
38: FIELD_SET_INT);
39:
40: public static final JoinPointType FIELD_GET = new JoinPointType(
41: FIELD_GET_INT);
42:
43: public static final JoinPointType HANDLER = new JoinPointType(
44: HANDLER_INT);
45:
46: public static final JoinPointType STATIC_INITIALIZATION = new JoinPointType(
47: STATIC_INITIALIZATION_INT);
48:
49: private int m_int;
50:
51: private JoinPointType(int asInt) {
52: m_int = asInt;
53: }
54:
55: public String toString() {
56: switch (m_int) {
57: case METHOD_EXECUTION_INT:
58: return "MethodExecution";
59: case METHOD_CALL_INT:
60: return "MethodCall";
61: case CONSTRUCTOR_EXECUTION_INT:
62: return "ConstructorExecution";
63: case CONSTRUCTOR_CALL_INT:
64: return "ConstructorCall";
65: case FIELD_GET_INT:
66: return "FieldGet";
67: case FIELD_SET_INT:
68: return "FieldSet";
69: case HANDLER_INT:
70: return "Handler";
71: case STATIC_INITIALIZATION_INT:
72: return "StaticInitialization";
73: default:
74: throw new Error("not supported join point type");
75: }
76: }
77:
78: public static JoinPointType fromInt(int asInt) {
79: return new JoinPointType(asInt);
80: }
81:
82: public boolean equals(Object o) {
83: if (this == o)
84: return true;
85: if (!(o instanceof JoinPointType))
86: return false;
87:
88: final JoinPointType joinPointType = (JoinPointType) o;
89:
90: if (m_int != joinPointType.m_int)
91: return false;
92:
93: return true;
94: }
95:
96: public int hashCode() {
97: return m_int;
98: }
99: }
|