Source Code Cross Referenced for XPojoMethodArgs.java in  » XML-UI » xui32 » com » xoetrope » data » pojo » 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 » XML UI » xui32 » com.xoetrope.data.pojo 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package com.xoetrope.data.pojo;
002:
003:        import java.lang.reflect.Method;
004:        import java.lang.reflect.Type;
005:        import java.lang.reflect.TypeVariable;
006:        import net.xoetrope.optional.data.pojo.XPojoModel;
007:        import net.xoetrope.xui.data.XModel;
008:
009:        /**
010:         * Finder arguments model.
011:         * <p> Copyright (c) Xoetrope Ltd., 2001-2007, This software is licensed under
012:         * the GNU Public License (GPL), please see license.txt for more details. If
013:         * you make commercial use of this software you must purchase a commercial
014:         * license from Xoetrope.</p>
015:         */
016:        public class XPojoMethodArgs extends XPojoModelVis {
017:            protected XPojoModelEx pojoFinder;
018:            protected Class[] parameterTypes;
019:            protected String[] genericNames;
020:            protected XPojoMethodArg[] pojoArgs;
021:
022:            /**
023:             * Creates a new instance of XPojoFinderArgs
024:             * @param ds XPojoDataSourceEx object
025:             * @param pt types of parameters
026:             */
027:
028:            public XPojoMethodArgs(XPojoModelEx pc, Method method,
029:                    XPojoDataSourceEx ds) {
030:                super (pc, method, ds);
031:                pojoFinder = pc;
032:                setParameters(method);
033:                setFinderArgs();
034:            }
035:
036:            public Class getPojoClass() {
037:                return null;
038:            }
039:
040:            /**
041:             * Stores the information about the method arguments
042:             * @param method the Method to be queried
043:             */
044:            private void setParameters(Method method) {
045:                if (method == null)
046:                    return;
047:                parameterTypes = method.getParameterTypes();
048:                if (parameterTypes == null)
049:                    parameterTypes = new Class[0];
050:                int numParameters = parameterTypes.length;
051:                Type[] types = method.getGenericParameterTypes();
052:                genericNames = new String[numParameters];
053:                for (int i = 0; i < numParameters; i++) {
054:                    if (types[i] instanceof  TypeVariable)
055:                        genericNames[i] = ((TypeVariable) types[i]).getName();
056:                    else
057:                        genericNames[i] = null;
058:                }
059:            }
060:
061:            /**
062:             * Returns the table containin parent method
063:             * argument types
064:             * @return the table containing types
065:             */
066:            public Class[] getParameterTypes() {
067:                return parameterTypes;
068:            }
069:
070:            /**
071:             * Gets the number of children
072:             * @return the number of children (parameters)
073:             */
074:            public int getNumChildren() {
075:                return (parameterTypes != null ? parameterTypes.length : 0);
076:            }
077:
078:            /**
079:             * Gets the finder argument.
080:             * @param i position of finder's argument in the list of arguments
081:             * @return XModel object representing finder's argument. 
082:             */
083:            public XModel get(int i) {
084:                if (i >= getNumChildren())
085:                    return null;
086:                return pojoArgs[i];
087:            }
088:
089:            /**
090:             * Defines this finder arguments and restores its values in order
091:             * to determine the number of children of this node.
092:             */
093:            protected void setFinderArgs() {
094:                int numChildren = getNumChildren();
095:                pojoArgs = new XPojoMethodArg[numChildren];
096:                XPropertiesRetriever af = dataSource.getPropertiesRetriever();
097:                for (int i = 0; i < numChildren; i++) {
098:                    Class type = parameterTypes[i];
099:                    String name = genericNames[i];
100:                    XPojoMethodArg arg = new XPojoMethodArg(this , i, type,
101:                            name, af);
102:                    arg.restoreArgument();
103:                    pojoArgs[i] = arg;
104:                }
105:            }
106:
107:            /**
108:             * Removes values of all arguments
109:             */
110:            public void removeAllArgumentValues() {
111:                int numArguments = pojoArgs.length;
112:                for (int i = 0; i < numArguments; i++) {
113:                    pojoArgs[i].removeValue();
114:                }
115:            }
116:
117:            /**
118:             * Determines whether values of all the arguments
119:             * hass been set
120:             * @return true if the values has been set,
121:             * false otherwise
122:             */
123:            public boolean argumentValuesSet() {
124:                int numArguments = pojoArgs.length;
125:                boolean argsSet = true;
126:                for (int i = 0; (i < numArguments) && argsSet; i++)
127:                    argsSet = pojoArgs[i].hasValue();
128:                return argsSet;
129:            }
130:
131:            /**
132:             * Gets the value of the element located at the path
133:             * @param element the path to the XPojoModel required
134:             * @return the value of the XPojoModel
135:             */
136:            public Object get(String element) {
137:                if ((element == null) || (element.length() == 0))
138:                    return null;
139:                if (element.charAt(0) == '/')
140:                    element = element.substring(1);
141:
142:                XModel model = null;
143:                int pos = element.indexOf('/');
144:                String subPath = pos > -1 ? element.substring(0, pos) : element;
145:
146:                if ((subPath != null) && (subPath.length() > 3)) {
147:                    String idxS = element.substring(3);
148:                    try {
149:                        model = get(Integer.parseInt(idxS));
150:                    } catch (NumberFormatException ex) {
151:                    }
152:                }
153:
154:                if ((pos >= 0) && (model != null)) {
155:                    model = (XPojoModel) model.get(element.substring(pos + 1));
156:                }
157:
158:                if (model != null)
159:                    model.setParent(this );
160:
161:                return model;
162:            }
163:
164:            /**
165:             * Gets the visualiser tree caption of this node
166:             * @return the caption
167:             */
168:            public String getCaption() {
169:                String caption = "arguments: ";
170:                setCaption(caption);
171:                return caption;
172:            }
173:
174:            public void set(Object value) {
175:
176:            }
177:
178:            public boolean getAttribRuntime(int i) {
179:                return true;
180:            }
181:
182:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.