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


001:        /*******************************************************************************
002:         * Copyright (c) 2000, 2007 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.internal.corext.refactoring;
011:
012:        import org.eclipse.core.runtime.Assert;
013:
014:        import org.eclipse.jdt.core.dom.ITypeBinding;
015:        import org.eclipse.jdt.core.dom.IVariableBinding;
016:
017:        public class ParameterInfo {
018:
019:            public static final int INDEX_FOR_ADDED = -1;
020:            public static final String ELLIPSIS = "..."; //$NON-NLS-1$
021:
022:            private IVariableBinding fOldBinding;
023:            private ITypeBinding fOldTypeBinding;
024:            private final String fOldName;
025:            private final String fOldTypeName;
026:            private final int fOldIndex;
027:
028:            private String fNewTypeName;
029:            private ITypeBinding fNewTypeBinding;
030:            private String fDefaultValue;
031:            private String fNewName;
032:            private boolean fIsDeleted;
033:            private boolean fCreateField = true;
034:            private boolean fInlined;
035:            private boolean fResolve = true;
036:
037:            public ParameterInfo(String type, String name, int index) {
038:                this (null, null, type, name, index);
039:            }
040:
041:            public ParameterInfo(IVariableBinding binding, String type,
042:                    String name, int index) {
043:                this (binding, null, type, name, index);
044:            }
045:
046:            private ParameterInfo(IVariableBinding binding,
047:                    ITypeBinding typeBinding, String type, String name,
048:                    int index) {
049:                fOldBinding = binding;
050:                fOldTypeBinding = typeBinding;
051:                fNewTypeBinding = typeBinding;
052:                fOldTypeName = type;
053:                fNewTypeName = type;
054:                fOldName = name;
055:                fNewName = name;
056:                fOldIndex = index;
057:                fDefaultValue = ""; //$NON-NLS-1$
058:                fIsDeleted = false;
059:            }
060:
061:            /**
062:             * Creates a new ParameterInfo. Parameter is marked as added and not resolvable
063:             * @param type the fullyqualified type
064:             * @param name the name
065:             * @return the parameter info object
066:             */
067:            public static ParameterInfo createInfoForAddedParameter(
068:                    String type, String name) {
069:                ParameterInfo info = new ParameterInfo("", "", INDEX_FOR_ADDED); //$NON-NLS-1$ //$NON-NLS-2$
070:                info.setNewTypeName(type);
071:                info.setNewName(name);
072:                info.setResolve(false);
073:                return info;
074:            }
075:
076:            private void setResolve(boolean resolve) {
077:                fResolve = resolve;
078:            }
079:
080:            public static ParameterInfo createInfoForAddedParameter(
081:                    String type, String name, String defaultValue) {
082:                ParameterInfo info = new ParameterInfo("", "", INDEX_FOR_ADDED); //$NON-NLS-1$ //$NON-NLS-2$
083:                info.setNewTypeName(type);
084:                info.setNewName(name);
085:                info.setDefaultValue(defaultValue);
086:                return info;
087:            }
088:
089:            public static ParameterInfo createInfoForAddedParameter(
090:                    ITypeBinding typeBinding, String type, String name,
091:                    String defaultValue) {
092:                ParameterInfo info = new ParameterInfo(null, typeBinding,
093:                        "", "", INDEX_FOR_ADDED); //$NON-NLS-1$ //$NON-NLS-2$
094:                info.setNewTypeName(type);
095:                info.setNewName(name);
096:                info.setDefaultValue(defaultValue);
097:                return info;
098:            }
099:
100:            public int getOldIndex() {
101:                return fOldIndex;
102:            }
103:
104:            public boolean isDeleted() {
105:                return fIsDeleted;
106:            }
107:
108:            public void markAsDeleted() {
109:                Assert.isTrue(!isAdded());//added param infos should be simply removed from the list
110:                fIsDeleted = true;
111:            }
112:
113:            public boolean isAdded() {
114:                return fOldIndex == INDEX_FOR_ADDED;
115:            }
116:
117:            public boolean isTypeNameChanged() {
118:                return !fOldTypeName.equals(fNewTypeName);
119:            }
120:
121:            public boolean isRenamed() {
122:                return !fOldName.equals(fNewName);
123:            }
124:
125:            public boolean isVarargChanged() {
126:                return isOldVarargs() != isNewVarargs();
127:            }
128:
129:            public IVariableBinding getOldBinding() {
130:                return fOldBinding;
131:            }
132:
133:            public String getOldTypeName() {
134:                return fOldTypeName;
135:            }
136:
137:            public String getNewTypeName() {
138:                return fNewTypeName;
139:            }
140:
141:            public void setNewTypeName(String type) {
142:                Assert.isNotNull(type);
143:                fNewTypeName = type;
144:            }
145:
146:            public ITypeBinding getNewTypeBinding() {
147:                return fNewTypeBinding;
148:            }
149:
150:            public void setNewTypeBinding(ITypeBinding typeBinding) {
151:                fNewTypeBinding = typeBinding;
152:            }
153:
154:            public boolean isOldVarargs() {
155:                return isVarargs(fOldTypeName);
156:            }
157:
158:            public boolean isNewVarargs() {
159:                return isVarargs(fNewTypeName);
160:            }
161:
162:            public String getOldName() {
163:                return fOldName;
164:            }
165:
166:            public String getNewName() {
167:                return fNewName;
168:            }
169:
170:            public void setNewName(String newName) {
171:                Assert.isNotNull(newName);
172:                fNewName = newName;
173:            }
174:
175:            public String getDefaultValue() {
176:                return fDefaultValue;
177:            }
178:
179:            public void setDefaultValue(String value) {
180:                Assert.isNotNull(value);
181:                fDefaultValue = value;
182:            }
183:
184:            public String toString() {
185:                return fOldTypeName
186:                        + " " + fOldName + " @" + fOldIndex + " -> " //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
187:                        + fNewTypeName + " " + fNewName + ": " + fDefaultValue //$NON-NLS-1$//$NON-NLS-2$
188:                        + (fIsDeleted ? " (deleted)" : " (stays)"); //$NON-NLS-1$//$NON-NLS-2$
189:            }
190:
191:            public static String stripEllipsis(String typeName) {
192:                if (isVarargs(typeName))
193:                    return typeName.substring(0, typeName.length() - 3);
194:                else
195:                    return typeName;
196:            }
197:
198:            public static boolean isVarargs(String typeName) {
199:                return typeName.endsWith("..."); //$NON-NLS-1$
200:            }
201:
202:            public ITypeBinding getOldTypeBinding() {
203:                return fOldTypeBinding;
204:            }
205:
206:            public boolean isCreateField() {
207:                return fCreateField;
208:            }
209:
210:            public void setCreateField(boolean createField) {
211:                fIsDeleted = createField;
212:                fCreateField = createField;
213:            }
214:
215:            public void setOldBinding(IVariableBinding binding) {
216:                //The variableBinding is needed by IPOR to check what modifier were present
217:                fOldBinding = binding;
218:                fOldTypeBinding = binding.getType();
219:                fNewTypeBinding = binding.getType();
220:            }
221:
222:            public void setInlined(boolean inlined) {
223:                fInlined = inlined;
224:            }
225:
226:            public boolean isInlined() {
227:                return fInlined;
228:            }
229:
230:            public boolean isResolve() {
231:                return fResolve;
232:            }
233:
234:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.