Source Code Cross Referenced for JMethod.java in  » J2EE » ow2-easybeans » org » ow2 » easybeans » deployment » annotations » 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 » J2EE » ow2 easybeans » org.ow2.easybeans.deployment.annotations 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * EasyBeans
003:         * Copyright (C) 2006 Bull S.A.S.
004:         * Contact: easybeans@ow2.org
005:         *
006:         * This library is free software; you can redistribute it and/or
007:         * modify it under the terms of the GNU Lesser General Public
008:         * License as published by the Free Software Foundation; either
009:         * version 2.1 of the License, or any later version.
010:         *
011:         * This library is distributed in the hope that it will be useful,
012:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
013:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014:         * Lesser General Public License for more details.
015:         *
016:         * You should have received a copy of the GNU Lesser General Public
017:         * License along with this library; if not, write to the Free Software
018:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
019:         * USA
020:         *
021:         * --------------------------------------------------------------------------
022:         * $Id: JMethod.java 2059 2007-11-22 17:22:33Z benoitf $
023:         * --------------------------------------------------------------------------
024:         */package org.ow2.easybeans.deployment.annotations;
025:
026:        import java.lang.reflect.Method;
027:        import java.util.Arrays;
028:
029:        import org.ow2.easybeans.asm.Type;
030:
031:        /**
032:         * This class defines a Method object. It is not based on reflection but allows
033:         * to build a JMethod based on java.lang.reflect.Method
034:         * @author Florent Benoit
035:         */
036:        public class JMethod {
037:
038:            /**
039:             * Name of the method.
040:             */
041:            private String name = null;
042:
043:            /**
044:             * Access mode (see {@link org.ow2.easybeans.asm.Opcodes}).
045:             */
046:            private int access;
047:
048:            /**
049:             * Method's descriptor.
050:             */
051:            private String descriptor = null;
052:
053:            /**
054:             * Method's signature.
055:             */
056:            private String signature;
057:
058:            /**
059:             * Exceptions of the method.
060:             */
061:            private final String[] exceptions;
062:
063:            /**
064:             * Constructor.
065:             * @param access the access mode (see {@link org.ow2.easybeans.asm.Opcodes})
066:             * @param name the method's name.
067:             * @param descriptor the method's descriptor (see
068:             *        {@link org.ow2.easybeans.asm.Type Type}).
069:             * @param signature the method's signature. May be <tt>null</tt> if the
070:             *        method parameters, return type and exceptions do not use generic
071:             *        types.
072:             * @param exceptions the internal names of the method's exception classes
073:             *        (see
074:             *        {@link org.ow2.easybeans.asm.Type#getInternalName() getInternalName}).
075:             *        May be <tt>null</tt>.
076:             */
077:            public JMethod(final int access, final String name,
078:                    final String descriptor, final String signature,
079:                    final String[] exceptions) {
080:                this .access = access;
081:                this .name = name;
082:                this .descriptor = descriptor;
083:                this .signature = signature;
084:                this .exceptions = exceptions;
085:            }
086:
087:            /**
088:             * @return the access mode (see {@link org.ow2.easybeans.asm.Opcodes})
089:             */
090:            public int getAccess() {
091:                return access;
092:            }
093:
094:            /**
095:             * Constructor.
096:             * @param m {@link java.lang.reflect.Method} method.
097:             */
098:            public JMethod(final Method m) {
099:                this .name = m.getName();
100:                this .descriptor = Type.getMethodDescriptor(m);
101:                // TODO: make this ok
102:                // this.signature = Type.signature;
103:                this .exceptions = null;
104:            }
105:
106:            /**
107:             * Indicates whether some other object is "equal to" this one.
108:             * @param obj object to compare
109:             * @return true if given object is equals
110:             */
111:            @Override
112:            public boolean equals(final Object obj) {
113:                if (obj != null && obj instanceof  JMethod) {
114:                    JMethod other = (JMethod) obj;
115:
116:                    // same name
117:                    if (!this .name.equals(other.name)) {
118:                        return false;
119:                    }
120:
121:                    // same descriptor
122:                    if ((this .descriptor != null)
123:                            && (!this .descriptor.equals(other.descriptor))) {
124:                        return false;
125:                    }
126:
127:                    // Don't check signature (which include generics information)
128:                    // For example void method(List<Integer>) and
129:                    //             void method(List<String>)
130:                    // and even if signature is different, they have same erasure
131:                    // This is not allowed, so don't need to check signature information.
132:
133:                    // if all tests succeed, return true
134:                    return true;
135:                }
136:                return false;
137:            }
138:
139:            /**
140:             * @return a hash code value for the object.
141:             */
142:            @Override
143:            public int hashCode() {
144:                return name.hashCode();
145:            }
146:
147:            /**
148:             * @return method descriptor
149:             */
150:            public String getDescriptor() {
151:                return descriptor;
152:            }
153:
154:            /**
155:             * @return method exceptions
156:             */
157:            public String[] getExceptions() {
158:                return exceptions;
159:            }
160:
161:            /**
162:             * @return method name
163:             */
164:            public String getName() {
165:                return name;
166:            }
167:
168:            /**
169:             * @return method signature
170:             */
171:            public String getSignature() {
172:                return signature;
173:            }
174:
175:            /**
176:             * @return string representation
177:             */
178:            @Override
179:            public String toString() {
180:                StringBuilder sb = new StringBuilder();
181:                // classname
182:                sb.append(this .getClass().getName().substring(
183:                        this .getClass().getPackage().getName().length() + 1));
184:
185:                // name
186:                sb.append("[name=");
187:                sb.append(name);
188:
189:                // access
190:                sb.append(", access=");
191:                sb.append(access);
192:
193:                // descriptor
194:                if (descriptor != null) {
195:                    sb.append(", descriptor=");
196:                    sb.append(descriptor);
197:                }
198:
199:                // signature
200:                if (signature != null) {
201:                    sb.append(", signature=");
202:                    sb.append(signature);
203:                }
204:
205:                // exceptions
206:                if (exceptions != null) {
207:                    sb.append(", exceptions=");
208:                    sb.append(Arrays.asList(exceptions));
209:                }
210:                sb.append("]");
211:                return sb.toString();
212:            }
213:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.