Source Code Cross Referenced for ConstructorInvocation.java in  » IDE-Eclipse » jdt » org » eclipse » jdt » core » dom » 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 » IDE Eclipse » jdt » org.eclipse.jdt.core.dom 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*******************************************************************************
002:         * Copyright (c) 2000, 2005 IBM Corporation and others.
003:         * All rights reserved. This program and the accompanying materials
004:         * are made available under the terms of the Eclipse Public License v1.0
005:         * which accompanies this distribution, and is available at
006:         * http://www.eclipse.org/legal/epl-v10.html
007:         *
008:         * Contributors:
009:         *     IBM Corporation - initial API and implementation
010:         *******************************************************************************/package org.eclipse.jdt.core.dom;
011:
012:        import java.util.ArrayList;
013:        import java.util.List;
014:
015:        /**
016:         * Alternate constructor invocation statement AST node type.
017:         * For JLS2:
018:         * <pre>
019:         * ConstructorInvocation:
020:         *		<b>this</b> <b>(</b> [ Expression { <b>,</b> Expression } ] <b>)</b> <b>;</b>
021:         * </pre>
022:         * For JLS3, type arguments are added:
023:         * <pre>
024:         * ConstructorInvocation:
025:         *      [ <b>&lt;</b> Type { <b>,</b> Type } <b>&gt;</b> ]
026:         *		      <b>this</b> <b>(</b> [ Expression { <b>,</b> Expression } ] <b>)</b> <b>;</b>
027:         * </pre>
028:         * 
029:         * @since 2.0
030:         */
031:        public class ConstructorInvocation extends Statement {
032:
033:            /**
034:             * The "typeArguments" structural property of this node type (added in JLS3 API).
035:             * @since 3.1
036:             */
037:            public static final ChildListPropertyDescriptor TYPE_ARGUMENTS_PROPERTY = new ChildListPropertyDescriptor(
038:                    ConstructorInvocation.class,
039:                    "typeArguments", Type.class, NO_CYCLE_RISK); //$NON-NLS-1$
040:
041:            /**
042:             * The "arguments" structural property of this node type.
043:             * @since 3.0
044:             */
045:            public static final ChildListPropertyDescriptor ARGUMENTS_PROPERTY = new ChildListPropertyDescriptor(
046:                    ConstructorInvocation.class,
047:                    "arguments", Expression.class, CYCLE_RISK); //$NON-NLS-1$
048:
049:            /**
050:             * A list of property descriptors (element type: 
051:             * {@link StructuralPropertyDescriptor}),
052:             * or null if uninitialized.
053:             * @since 3.0
054:             */
055:            private static final List PROPERTY_DESCRIPTORS_2_0;
056:
057:            /**
058:             * A list of property descriptors (element type: 
059:             * {@link StructuralPropertyDescriptor}),
060:             * or null if uninitialized.
061:             * @since 3.1
062:             */
063:            private static final List PROPERTY_DESCRIPTORS_3_0;
064:
065:            static {
066:                List properyList = new ArrayList(2);
067:                createPropertyList(ConstructorInvocation.class, properyList);
068:                addProperty(ARGUMENTS_PROPERTY, properyList);
069:                PROPERTY_DESCRIPTORS_2_0 = reapPropertyList(properyList);
070:
071:                properyList = new ArrayList(3);
072:                createPropertyList(ConstructorInvocation.class, properyList);
073:                addProperty(TYPE_ARGUMENTS_PROPERTY, properyList);
074:                addProperty(ARGUMENTS_PROPERTY, properyList);
075:                PROPERTY_DESCRIPTORS_3_0 = reapPropertyList(properyList);
076:            }
077:
078:            /**
079:             * Returns a list of structural property descriptors for this node type.
080:             * Clients must not modify the result.
081:             * 
082:             * @param apiLevel the API level; one of the
083:             * <code>AST.JLS*</code> constants
084:
085:             * @return a list of property descriptors (element type: 
086:             * {@link StructuralPropertyDescriptor})
087:             * @since 3.0
088:             */
089:            public static List propertyDescriptors(int apiLevel) {
090:                if (apiLevel == AST.JLS2_INTERNAL) {
091:                    return PROPERTY_DESCRIPTORS_2_0;
092:                } else {
093:                    return PROPERTY_DESCRIPTORS_3_0;
094:                }
095:            }
096:
097:            /**
098:             * The type arguments (element type: <code>Type</code>). 
099:             * Null in JLS2. Added in JLS3; defaults to an empty list
100:             * (see constructor).
101:             * @since 3.1
102:             */
103:            private ASTNode.NodeList typeArguments = null;
104:
105:            /**
106:             * The list of argument expressions (element type: 
107:             * <code>Expression</code>). Defaults to an empty list.
108:             */
109:            private ASTNode.NodeList arguments = new ASTNode.NodeList(
110:                    ARGUMENTS_PROPERTY);
111:
112:            /**
113:             * Creates a new AST node for an alternate constructor invocation statement
114:             * owned by the given AST. By default, an empty list of arguments.
115:             * 
116:             * @param ast the AST that is to own this node
117:             */
118:            ConstructorInvocation(AST ast) {
119:                super (ast);
120:                if (ast.apiLevel >= AST.JLS3) {
121:                    this .typeArguments = new ASTNode.NodeList(
122:                            TYPE_ARGUMENTS_PROPERTY);
123:                }
124:            }
125:
126:            /* (omit javadoc for this method)
127:             * Method declared on ASTNode.
128:             */
129:            final List internalStructuralPropertiesForType(int apiLevel) {
130:                return propertyDescriptors(apiLevel);
131:            }
132:
133:            /* (omit javadoc for this method)
134:             * Method declared on ASTNode.
135:             */
136:            final List internalGetChildListProperty(
137:                    ChildListPropertyDescriptor property) {
138:                if (property == ARGUMENTS_PROPERTY) {
139:                    return arguments();
140:                }
141:                if (property == TYPE_ARGUMENTS_PROPERTY) {
142:                    return typeArguments();
143:                }
144:                // allow default implementation to flag the error
145:                return super .internalGetChildListProperty(property);
146:            }
147:
148:            /* (omit javadoc for this method)
149:             * Method declared on ASTNode.
150:             */
151:            final int getNodeType0() {
152:                return CONSTRUCTOR_INVOCATION;
153:            }
154:
155:            /* (omit javadoc for this method)
156:             * Method declared on ASTNode.
157:             */
158:            ASTNode clone0(AST target) {
159:                ConstructorInvocation result = new ConstructorInvocation(target);
160:                result
161:                        .setSourceRange(this .getStartPosition(), this 
162:                                .getLength());
163:                result.copyLeadingComment(this );
164:                if (this .ast.apiLevel >= AST.JLS3) {
165:                    result.typeArguments().addAll(
166:                            ASTNode.copySubtrees(target, typeArguments()));
167:                }
168:                result.arguments().addAll(
169:                        ASTNode.copySubtrees(target, arguments()));
170:                return result;
171:            }
172:
173:            /* (omit javadoc for this method)
174:             * Method declared on ASTNode.
175:             */
176:            final boolean subtreeMatch0(ASTMatcher matcher, Object other) {
177:                // dispatch to correct overloaded match method
178:                return matcher.match(this , other);
179:            }
180:
181:            /* (omit javadoc for this method)
182:             * Method declared on ASTNode.
183:             */
184:            void accept0(ASTVisitor visitor) {
185:                boolean visitChildren = visitor.visit(this );
186:                if (visitChildren) {
187:                    if (this .ast.apiLevel >= AST.JLS3) {
188:                        acceptChildren(visitor, this .typeArguments);
189:                    }
190:                    acceptChildren(visitor, this .arguments);
191:                }
192:                visitor.endVisit(this );
193:            }
194:
195:            /**
196:             * Returns the live ordered list of type arguments of this constructor
197:             * invocation (added in JLS3 API).
198:             * 
199:             * @return the live list of type arguments
200:             *    (element type: <code>Type</code>)
201:             * @exception UnsupportedOperationException if this operation is used in
202:             * a JLS2 AST
203:             * @since 3.1
204:             */
205:            public List typeArguments() {
206:                // more efficient than just calling unsupportedIn2() to check
207:                if (this .typeArguments == null) {
208:                    unsupportedIn2();
209:                }
210:                return this .typeArguments;
211:            }
212:
213:            /**
214:             * Returns the live ordered list of argument expressions in this alternate
215:             * constructor invocation statement.
216:             * 
217:             * @return the live list of argument expressions 
218:             *    (element type: <code>Expression</code>)
219:             */
220:            public List arguments() {
221:                return this .arguments;
222:            }
223:
224:            /**
225:             * Resolves and returns the binding for the constructor invoked by this
226:             * expression.
227:             * <p>
228:             * Note that bindings are generally unavailable unless requested when the
229:             * AST is being built.
230:             * </p>
231:             * 
232:             * @return the constructor binding, or <code>null</code> if the binding
233:             *    cannot be resolved
234:             */
235:            public IMethodBinding resolveConstructorBinding() {
236:                return this .ast.getBindingResolver().resolveConstructor(this );
237:            }
238:
239:            /* (omit javadoc for this method)
240:             * Method declared on ASTNode.
241:             */
242:            int memSize() {
243:                // treat Code as free
244:                return BASE_NODE_SIZE + 2 * 4;
245:            }
246:
247:            /* (omit javadoc for this method)
248:             * Method declared on ASTNode.
249:             */
250:            int treeSize() {
251:                return memSize()
252:                        + (this .typeArguments == null ? 0 : this .typeArguments
253:                                .listSize())
254:                        + (this .arguments == null ? 0 : this.arguments
255:                                .listSize());
256:            }
257:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.