Source Code Cross Referenced for AdviceInfo.java in  » Aspect-oriented » aspectwerkz-2.0 » org » codehaus » aspectwerkz » aspect » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Aspect oriented » aspectwerkz 2.0 » org.codehaus.aspectwerkz.aspect 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**************************************************************************************
002:         * Copyright (c) Jonas BonŽr, Alexandre Vasseur. All rights reserved.                 *
003:         * http://aspectwerkz.codehaus.org                                                    *
004:         * ---------------------------------------------------------------------------------- *
005:         * The software in this package is published under the terms of the LGPL license      *
006:         * a copy of which has been included with this distribution in the license.txt file.  *
007:         **************************************************************************************/package org.codehaus.aspectwerkz.aspect;
008:
009:        import org.codehaus.aspectwerkz.transform.inlining.AsmHelper;
010:        import org.codehaus.aspectwerkz.expression.ExpressionInfo;
011:        import org.codehaus.aspectwerkz.expression.ExpressionContext;
012:        import org.codehaus.aspectwerkz.definition.AdviceDefinition;
013:        import org.codehaus.aspectwerkz.DeploymentModel;
014:        import org.objectweb.asm.Type;
015:
016:        import java.io.Serializable;
017:
018:        /**
019:         * Contains advice info, like indexes describing the aspect and a method (advice or introduced),
020:         * aspect manager etc.
021:         *
022:         * @author <a href="mailto:jboner@codehaus.org">Jonas BonŽr </a>
023:         * @author <a href="mailto:alex@gnilux.com">Alexandre Vasseur </a>
024:         */
025:        public class AdviceInfo implements  Serializable {
026:
027:            public final static AdviceInfo[] EMPTY_ADVICE_INFO_ARRAY = new AdviceInfo[0];
028:
029:            // -- some magic index used in the m_methodToArgIndexes[] so that we know what to bind except advised target args
030:            // -- those constants MUST be negative since positive values are used for args(..) binding
031:            public final static int JOINPOINT_ARG = -0x1;
032:            public final static int STATIC_JOINPOINT_ARG = -0x2;
033:            public final static int TARGET_ARG = -0x3;
034:            public final static int THIS_ARG = -0x4;
035:            public final static int VALID_NON_AW_AROUND_CLOSURE_TYPE = -0x5;
036:            public final static int SPECIAL_ARGUMENT = -0x6;
037:            public static final int CUSTOM_JOIN_POINT_ARG = -0x7;
038:
039:            /**
040:             * The method name.
041:             */
042:            private String m_methodName;
043:
044:            /**
045:             * The method sig.
046:             */
047:            private String m_methodSignature;
048:
049:            /**
050:             * The method's parameter types.
051:             */
052:            private Type[] m_methodParameterTypes;
053:
054:            /**
055:             * The advice name
056:             * <adviceMethodName>[(... call signature)]
057:             */
058:            private final String m_name;
059:
060:            /**
061:             * The aspect class name where this advice is defined.
062:             */
063:            private String m_aspectClassName;
064:
065:            /**
066:             * The aspect qualified name - <uuid>/<aspectNickName or FQNclassName>
067:             */
068:            private String m_aspectQualifiedName;
069:
070:            /**
071:             * The aspect deployment model
072:             */
073:            private DeploymentModel m_aspectDeploymentModel;
074:
075:            /**
076:             * The advice method arg index mapped to the advisED target arg index.
077:             * If the value is greater or equal to 0, it is an args binding. Else, it is a magic index
078:             * (see constants JOINPOINT_ARG, STATIC_JOINPOINT_ARG, THIS_ARG, TARGET_ARG)
079:             */
080:            private int[] m_methodToArgIndexes;
081:
082:            /**
083:             * The "special" argument type desc for the advice.
084:             */
085:            private String m_specialArgumentTypeDesc;
086:
087:            /**
088:             * The "special" argument type name for the advice.
089:             */
090:            private String m_specialArgumentTypeName;
091:
092:            /**
093:             * The advice type.
094:             */
095:            private AdviceType m_type;
096:
097:            /**
098:             * Runtime check flag.
099:             */
100:            private boolean m_targetWithRuntimeCheck;
101:
102:            /**
103:             * The expression info.
104:             */
105:            private ExpressionInfo m_expressionInfo;
106:
107:            /**
108:             * The expression context.
109:             */
110:            private ExpressionContext m_expressionContext;
111:
112:            /**
113:             * The advice definition for this advice.
114:             */
115:            private AdviceDefinition m_adviceDef;
116:
117:            /**
118:             * TODO refactor - many member fields holds data that is in either the adviceDef (which is in the class) or the aspectDef (which is accessible from the adviceDef)
119:             * <p/>
120:             * Creates a new advice info.
121:             *
122:             * @param aspectQualifiedName
123:             * @param aspectClassName
124:             * @param aspectDeploymentModel
125:             * @param methodName
126:             * @param methodSignature
127:             * @param methodParameterTypes
128:             * @param type                   the advice type
129:             * @param specialArgumentType    the special arg type
130:             * @param adviceName             full qualified advice method name (aspectFQN/advice(call sig))
131:             * @param targetWithRuntimeCheck true if a runtime check is needed based on target instance
132:             * @param expressionInfo
133:             * @param expressionContext
134:             * @param adviceDef
135:             */
136:            public AdviceInfo(final String aspectQualifiedName,
137:                    final String aspectClassName,
138:                    final DeploymentModel aspectDeploymentModel,
139:                    final String methodName, final String methodSignature,
140:                    final Type[] methodParameterTypes, final AdviceType type,
141:                    final String specialArgumentType, final String adviceName,
142:                    final boolean targetWithRuntimeCheck,
143:                    final ExpressionInfo expressionInfo,
144:                    final ExpressionContext expressionContext,
145:                    final AdviceDefinition adviceDef) {
146:                m_aspectQualifiedName = aspectQualifiedName;
147:                m_aspectClassName = aspectClassName;
148:                m_aspectDeploymentModel = aspectDeploymentModel;
149:                m_methodName = methodName;
150:                m_methodSignature = methodSignature;
151:                m_methodParameterTypes = methodParameterTypes;
152:                m_type = type;
153:                if (specialArgumentType != null
154:                        && specialArgumentType.length() > 0) {//AW-434
155:                    m_specialArgumentTypeDesc = AsmHelper
156:                            .convertReflectDescToTypeDesc(specialArgumentType);
157:                    m_specialArgumentTypeName = specialArgumentType.replace(
158:                            '.', '/');
159:                }
160:                m_name = adviceName;
161:                m_targetWithRuntimeCheck = targetWithRuntimeCheck;
162:                m_expressionInfo = expressionInfo;
163:                m_expressionContext = expressionContext;
164:                m_adviceDef = adviceDef;
165:            }
166:
167:            /**
168:             * Return the method name.
169:             *
170:             * @return the method name
171:             */
172:            public String getMethodName() {
173:                return m_methodName;
174:            }
175:
176:            /**
177:             * Return the method signature.
178:             *
179:             * @return the method signature
180:             */
181:            public String getMethodSignature() {
182:                return m_methodSignature;
183:            }
184:
185:            /**
186:             * Return the method name.
187:             *
188:             * @return the method name
189:             */
190:            public Type[] getMethodParameterTypes() {
191:                return m_methodParameterTypes;
192:            }
193:
194:            /**
195:             * Returns the aspect qualified name.
196:             *
197:             * @return the aspect qualified name
198:             */
199:            public String getAspectQualifiedName() {
200:                return m_aspectQualifiedName;
201:            }
202:
203:            /**
204:             * Returns the aspect FQN className.
205:             *
206:             * @return the aspect class name
207:             */
208:            public String getAspectClassName() {
209:                return m_aspectClassName;
210:            }
211:
212:            /**
213:             * Returns the aspect deployment model
214:             *
215:             * @return
216:             */
217:            public DeploymentModel getAspectDeploymentModel() {
218:                return m_aspectDeploymentModel;
219:            }
220:
221:            /**
222:             * Returns the name of the advice.
223:             *
224:             * @return
225:             */
226:            public String getName() {
227:                return m_name;
228:            }
229:
230:            /**
231:             * Sets the advice method to target method arg mapping A value of -1 means "not mapped"
232:             *
233:             * @param map
234:             */
235:            public void setMethodToArgIndexes(final int[] map) {
236:                m_methodToArgIndexes = map;
237:            }
238:
239:            /**
240:             * Returns the advice method to target method arg index mapping.
241:             *
242:             * @return the indexes
243:             */
244:            public int[] getMethodToArgIndexes() {
245:                return m_methodToArgIndexes;
246:            }
247:
248:            /**
249:             * Returns the special argument type desc.
250:             *
251:             * @return
252:             */
253:            public String getSpecialArgumentTypeDesc() {
254:                return m_specialArgumentTypeDesc;
255:            }
256:
257:            /**
258:             * Returns the special argument type name.
259:             *
260:             * @return
261:             */
262:            public String getSpecialArgumentTypeName() {
263:                return m_specialArgumentTypeName;
264:            }
265:
266:            /**
267:             * Returns the advice type.
268:             *
269:             * @return
270:             */
271:            public AdviceType getType() {
272:                return m_type;
273:            }
274:
275:            /**
276:             * Checks if the target has a runtime check.
277:             *
278:             * @return
279:             */
280:            public boolean hasTargetWithRuntimeCheck() {
281:                return m_targetWithRuntimeCheck;
282:            }
283:
284:            /**
285:             * Returns the expression info.
286:             *
287:             * @return
288:             */
289:            public ExpressionInfo getExpressionInfo() {
290:                return m_expressionInfo;
291:            }
292:
293:            /**
294:             * Returns the expression context.
295:             *
296:             * @return
297:             */
298:            public ExpressionContext getExpressionContext() {
299:                return m_expressionContext;
300:            }
301:
302:            /**
303:             * Returns the advice definition.
304:             *
305:             * @return
306:             */
307:            public AdviceDefinition getAdviceDefinition() {
308:                return m_adviceDef;
309:            }
310:
311:            public String toString() {
312:                StringBuffer sb = new StringBuffer("AdviceInfo[");
313:                sb.append(m_type).append(',');
314:                sb.append(m_aspectQualifiedName).append(',');
315:                sb.append(m_name).append(',');
316:                sb.append(m_methodName).append(',');
317:                sb.append(m_methodSignature).append(',');
318:                sb.append(m_methodParameterTypes).append(',');
319:                sb.append(m_specialArgumentTypeDesc).append(',');
320:                sb.append(m_expressionInfo).append(',');
321:                sb.append(m_expressionContext).append(',');
322:                sb.append(m_targetWithRuntimeCheck).append(']');
323:                sb.append(hashCode());
324:                return sb.toString();
325:            }
326:
327:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.