Source Code Cross Referenced for AsmMethodInfo.java in  » Net » Terracotta » com » tc » object » bytecode » aspectwerkz » 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 » Net » Terracotta » com.tc.object.bytecode.aspectwerkz 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice.  All rights reserved.
003:         */
004:        package com.tc.object.bytecode.aspectwerkz;
005:
006:        import org.apache.commons.lang.builder.ToStringBuilder;
007:
008:        import com.tc.asm.Type;
009:        import com.tc.aspectwerkz.reflect.ClassInfo;
010:        import com.tc.aspectwerkz.reflect.MethodInfo;
011:        import com.tc.backport175.bytecode.AnnotationElement;
012:        import com.tc.exception.ImplementMe;
013:
014:        import java.lang.reflect.Method;
015:
016:        /**
017:         * Converts Asm method descriptions to Aspectwerkz MethodInfo
018:         */
019:        public class AsmMethodInfo implements  MethodInfo {
020:            private int modifiers;
021:            private ClassInfo declaringType;
022:            private String name;
023:            private ClassInfo returnTypeInfo;
024:            private ClassInfo[] parameterTypeInfos;
025:            private ClassInfo[] exceptionTypeInfos;
026:            private ClassInfoFactory classInfoFactory;
027:
028:            public AsmMethodInfo(ClassInfoFactory classInfoFactory,
029:                    int modifiers, String className, String methodName,
030:                    String desc, String[] exceptions) {
031:                this .classInfoFactory = classInfoFactory;
032:                // handle modifiers
033:                this .modifiers = modifiers;
034:                // handle declaring type
035:                this .declaringType = classInfoFactory.getClassInfo(className);//new SimpleClassInfo(className);
036:                // handle method name
037:                this .name = methodName.equals("<init>") ? "__INIT__"
038:                        : methodName;
039:                // handle return type.
040:                this .returnTypeInfo = type2ClassInfo(Type.getReturnType(desc));
041:                // handle parameter types
042:                Type[] parameterTypes = Type.getArgumentTypes(desc);
043:                this .parameterTypeInfos = types2ClassInfos(parameterTypes);
044:                // handle exception types
045:                this .exceptionTypeInfos = classNames2ClassInfos(exceptions);
046:            }
047:
048:            public String toString() {
049:                return ToStringBuilder.reflectionToString(this );
050:            }
051:
052:            private ClassInfo[] classNames2ClassInfos(String[] classNames) {
053:                if (classNames == null)
054:                    return null;
055:                ClassInfo[] rv = new ClassInfo[classNames.length];
056:                for (int i = 0; i < classNames.length; i++) {
057:                    rv[i] = className2ClassInfo(classNames[i]);
058:                }
059:                return rv;
060:            }
061:
062:            private ClassInfo[] types2ClassInfos(Type[] types) {
063:                if (types == null)
064:                    return null;
065:                ClassInfo[] rv = new ClassInfo[types.length];
066:                for (int i = 0; i < types.length; i++) {
067:                    rv[i] = type2ClassInfo(types[i]);
068:                }
069:                return rv;
070:            }
071:
072:            private ClassInfo className2ClassInfo(String className) {
073:                return classInfoFactory.getClassInfo(className);//new SimpleClassInfo(className);
074:            }
075:
076:            private ClassInfo type2ClassInfo(Type type) {
077:                return className2ClassInfo(type.getClassName());
078:            }
079:
080:            public ClassInfo getReturnType() {
081:                return this .returnTypeInfo;
082:            }
083:
084:            public ClassInfo[] getParameterTypes() {
085:                return this .parameterTypeInfos;
086:            }
087:
088:            public String[] getParameterNames() {
089:                return new String[0]; //To change body of implemented methods use File | Settings | File Templates.
090:            }
091:
092:            public ClassInfo[] getExceptionTypes() {
093:                return this .exceptionTypeInfos;
094:            }
095:
096:            public ClassInfo getDeclaringType() {
097:                return this .declaringType;
098:            }
099:
100:            public String getName() {
101:                return this .name;
102:            }
103:
104:            public String getSignature() {
105:                return null;
106:            }
107:
108:            public String getGenericsSignature() {
109:                return null;
110:            }
111:
112:            public int getModifiers() {
113:                return modifiers;
114:            }
115:
116:            public AnnotationElement.Annotation[] getAnnotations() {
117:                throw new ImplementMe();
118:            }
119:
120:            /**
121:             * Creates a new AsmMethodInfo from the given Method. This is only used for testing.
122:             */
123:            public static AsmMethodInfo createNewAsmMethodInfo(Method method) {
124:                int modifiers = method.getModifiers();
125:                String className = method.getDeclaringClass().getName();
126:                String methodName = method.getName();
127:                String desc = Type.getMethodDescriptor(method);
128:                Class[] exceptionTypes = method.getExceptionTypes();
129:                String[] exceptionTypeNames = new String[exceptionTypes.length];
130:                for (int i = 0; i < exceptionTypes.length; i++) {
131:                    exceptionTypeNames[i] = exceptionTypes[i].getName();
132:                }
133:                return new AsmMethodInfo(new ClassInfoFactory(), modifiers,
134:                        className, methodName, desc, exceptionTypeNames);
135:            }
136:
137:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.