Source Code Cross Referenced for JTypeParameter.java in  » Ajax » GWT » com » google » gwt » core » ext » typeinfo » 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 » Ajax » GWT » com.google.gwt.core.ext.typeinfo 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2007 Google Inc.
003:         * 
004:         * Licensed under the Apache License, Version 2.0 (the "License"); you may not
005:         * use this file except in compliance with the License. You may obtain a copy of
006:         * the License at
007:         * 
008:         * http://www.apache.org/licenses/LICENSE-2.0
009:         * 
010:         * Unless required by applicable law or agreed to in writing, software
011:         * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
012:         * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
013:         * License for the specific language governing permissions and limitations under
014:         * the License.
015:         */
016:        package com.google.gwt.core.ext.typeinfo;
017:
018:        import java.util.ArrayList;
019:        import java.util.List;
020:
021:        /**
022:         * Represents one of the type parameters in a generic type.
023:         */
024:        public class JTypeParameter extends JDelegatingClassType implements 
025:                HasBounds {
026:            private JBound bounds;
027:            private final JGenericType declaringClass;
028:            private final JAbstractMethod declaringMethod;
029:            private final int ordinal;
030:            private final String typeName;
031:
032:            public JTypeParameter(String typeName,
033:                    JAbstractMethod declaringMethod, int ordinal) {
034:                this .typeName = typeName;
035:                this .declaringMethod = declaringMethod;
036:                this .declaringClass = null;
037:                this .ordinal = ordinal;
038:                declaringMethod.addTypeParameter(this );
039:            }
040:
041:            public JTypeParameter(String typeName, JGenericType declaringClass,
042:                    int ordinal) {
043:                this .typeName = typeName;
044:                this .declaringClass = declaringClass;
045:                this .declaringMethod = null;
046:                this .ordinal = ordinal;
047:                declaringClass.addTypeParameter(this );
048:            }
049:
050:            @Override
051:            public JField findField(String name) {
052:                return getBaseType().findField(name);
053:            }
054:
055:            @Override
056:            public JMethod findMethod(String name, JType[] paramTypes) {
057:                return getBaseType().findMethod(name, paramTypes);
058:            }
059:
060:            public JBound getBounds() {
061:                return bounds;
062:            }
063:
064:            public JRealClassType getDeclaringClass() {
065:                return declaringClass;
066:            }
067:
068:            @Override
069:            public JField getField(String name) {
070:                return getBaseType().getField(name);
071:            }
072:
073:            @Override
074:            public JField[] getFields() {
075:                return getBaseType().getFields();
076:            }
077:
078:            public JClassType getFirstBound() {
079:                return getBaseType();
080:            }
081:
082:            @Override
083:            public JMethod getMethod(String name, JType[] paramTypes)
084:                    throws NotFoundException {
085:                return getBaseType().getMethod(name, paramTypes);
086:            }
087:
088:            @Override
089:            public JMethod[] getMethods() {
090:                return getBaseType().getMethods();
091:            }
092:
093:            @Override
094:            public String getName() {
095:                return typeName;
096:            }
097:
098:            @Override
099:            public String getParameterizedQualifiedSourceName() {
100:                return typeName;
101:            }
102:
103:            @Override
104:            public String getQualifiedSourceName() {
105:                return typeName + bounds.getQualifiedSourceName();
106:            }
107:
108:            @Override
109:            public String getSimpleSourceName() {
110:                return typeName + bounds.getSimpleSourceName();
111:            }
112:
113:            @Override
114:            public JClassType[] getSubtypes() {
115:                JClassType[] subtypes = super .getSubtypes();
116:                List<JClassType> intersectionTypes = new ArrayList<JClassType>();
117:
118:                if (getFirstBound().isInterface() == null
119:                        && isAssignableFrom(getFirstBound())) {
120:                    // Include the first bound as a subtype if it is not an interface and it
121:                    // is assignable to all of our bounds.
122:                    intersectionTypes.add(getFirstBound());
123:                }
124:
125:                for (JClassType subtype : subtypes) {
126:                    if (isAssignableFrom(subtype)) {
127:                        intersectionTypes.add(subtype);
128:                    }
129:                }
130:
131:                // Only types that intersect with all our bounds make it here. 
132:                return intersectionTypes.toArray(TypeOracle.NO_JCLASSES);
133:            }
134:
135:            @Override
136:            public boolean isAssignableFrom(JClassType otherType) {
137:                if (otherType == this ) {
138:                    return true;
139:                }
140:
141:                return getBounds().isAssignableFrom(otherType);
142:            }
143:
144:            @Override
145:            public boolean isAssignableTo(JClassType otherType) {
146:                if (otherType == this ) {
147:                    return true;
148:                }
149:
150:                return getBounds().isAssignableTo(otherType);
151:            }
152:
153:            @Override
154:            public JGenericType isGenericType() {
155:                return null;
156:            }
157:
158:            @Override
159:            public JParameterizedType isParameterized() {
160:                return null;
161:            }
162:
163:            @Override
164:            public JRawType isRawType() {
165:                return null;
166:            }
167:
168:            @Override
169:            public JTypeParameter isTypeParameter() {
170:                return this ;
171:            }
172:
173:            @Override
174:            public JWildcardType isWildcard() {
175:                return null;
176:            }
177:
178:            public void setBounds(JBound bounds) {
179:                this .bounds = bounds;
180:                super .setBaseType(bounds.getFirstBound());
181:            }
182:
183:            @Override
184:            public String toString() {
185:                if (getBaseType().isInterface() != null) {
186:                    return "interface " + getQualifiedSourceName();
187:                } else {
188:                    return "class " + getQualifiedSourceName();
189:                }
190:            }
191:
192:            int getOrdinal() {
193:                return ordinal;
194:            }
195:
196:            @Override
197:            JClassType getSubstitutedType(JParameterizedType parameterizedType) {
198:                return parameterizedType.getTypeParameterSubstitution(this);
199:            }
200:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.