KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > codehaus > aspectwerkz > joinpoint > management > JoinPointType


1 /**************************************************************************************
2  * Copyright (c) Jonas BonŽr, Alexandre Vasseur. All rights reserved. *
3  * http://aspectwerkz.codehaus.org *
4  * ---------------------------------------------------------------------------------- *
5  * The software in this package is published under the terms of the LGPL license *
6  * a copy of which has been included with this distribution in the license.txt file. *
7  **************************************************************************************/

8 package org.codehaus.aspectwerkz.joinpoint.management;
9
10 /**
11  * Enumeration for all join point types.
12  *
13  * @author <a HREF="mailto:jboner@codehaus.org">Jonas BonŽr </a>
14  */

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