Source Code Cross Referenced for MockParameter.java in  » Development » Java-Plugin-Framework » org » java » plugin » tools » mocks » 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 » Development » Java Plugin Framework » org.java.plugin.tools.mocks 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*****************************************************************************
002:         * Java Plug-in Framework (JPF)
003:         * Copyright (C) 2006-2007 Dmitry Olshansky
004:         * 
005:         * This library is free software; you can redistribute it and/or
006:         * modify it under the terms of the GNU Lesser General Public
007:         * License as published by the Free Software Foundation; either
008:         * version 2.1 of the License, or (at your option) any later version.
009:         * 
010:         * This library is distributed in the hope that it will be useful,
011:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
012:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
013:         * Lesser General Public License for more details.
014:         * 
015:         * You should have received a copy of the GNU Lesser General Public
016:         * License along with this library; if not, write to the Free Software
017:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
018:         *****************************************************************************/package org.java.plugin.tools.mocks;
019:
020:        import java.net.URL;
021:        import java.util.Collection;
022:        import java.util.Collections;
023:        import java.util.Date;
024:        import java.util.LinkedList;
025:        import org.java.plugin.PathResolver;
026:        import org.java.plugin.registry.Extension;
027:        import org.java.plugin.registry.ExtensionPoint;
028:        import org.java.plugin.registry.PluginDescriptor;
029:        import org.java.plugin.registry.Extension.Parameter;
030:        import org.java.plugin.registry.ExtensionPoint.ParameterDefinition;
031:
032:        /**
033:         * @version $Id$
034:         */
035:        public class MockParameter extends MockPluginElement<Parameter>
036:                implements  Parameter {
037:            private Extension declaringExtension;
038:            private ParameterDefinition definition;
039:            private Parameter super Parameter;
040:            private String rawValue;
041:            private Object typedValue;
042:            private LinkedList<Parameter> subParameters = new LinkedList<Parameter>();
043:
044:            /**
045:             * No-arguments constructor.
046:             */
047:            public MockParameter() {
048:                // no-op
049:            }
050:
051:            /**
052:             * @param id parameter ID
053:             * @param aRawValue raw parameter value
054:             * @param aTypedValue typed parameter value
055:             */
056:            public MockParameter(final String id, final String aRawValue,
057:                    final Object aTypedValue) {
058:                setId(id);
059:                rawValue = aRawValue;
060:                typedValue = aTypedValue;
061:            }
062:
063:            /**
064:             * @param id parameter ID
065:             * @param aRawValue raw parameter value
066:             * @param aTypedValue typed parameter value
067:             * @param aDeclaringExtension declaring extension
068:             */
069:            public MockParameter(final String id, final String aRawValue,
070:                    final Object aTypedValue,
071:                    final Extension aDeclaringExtension) {
072:                setId(id);
073:                rawValue = aRawValue;
074:                typedValue = aTypedValue;
075:                declaringExtension = aDeclaringExtension;
076:            }
077:
078:            /**
079:             * @see org.java.plugin.registry.Extension.Parameter#getDeclaringExtension()
080:             */
081:            public Extension getDeclaringExtension() {
082:                return declaringExtension;
083:            }
084:
085:            /**
086:             * @param value the declaring extension to set
087:             * @return this instance
088:             */
089:            public MockParameter setDeclaringExtension(final Extension value) {
090:                declaringExtension = value;
091:                return this ;
092:            }
093:
094:            /**
095:             * @see org.java.plugin.registry.Extension.Parameter#getDefinition()
096:             */
097:            public ParameterDefinition getDefinition() {
098:                return definition;
099:            }
100:
101:            /**
102:             * @param value the parameter definition to set
103:             * @return this instance
104:             */
105:            public MockParameter setDefinition(final ParameterDefinition value) {
106:                definition = value;
107:                return this ;
108:            }
109:
110:            /**
111:             * @see org.java.plugin.registry.Extension.Parameter#getSubParameter(
112:             *      java.lang.String)
113:             */
114:            public Parameter getSubParameter(final String id) {
115:                for (Parameter param : subParameters) {
116:                    if (param.getId().equals(id)) {
117:                        return param;
118:                    }
119:                }
120:                throw new IllegalArgumentException("unknown parameter ID " + id); //$NON-NLS-1$
121:            }
122:
123:            /**
124:             * @see org.java.plugin.registry.Extension.Parameter#getSubParameters()
125:             */
126:            public Collection<Parameter> getSubParameters() {
127:                return Collections.unmodifiableCollection(subParameters);
128:            }
129:
130:            /**
131:             * @see org.java.plugin.registry.Extension.Parameter#getSubParameters(
132:             *      java.lang.String)
133:             */
134:            public Collection<Parameter> getSubParameters(final String id) {
135:                LinkedList<Parameter> result = new LinkedList<Parameter>();
136:                for (Parameter param : subParameters) {
137:                    if (param.getId().equals(id)) {
138:                        result.add(param);
139:                    }
140:                }
141:                return result;
142:            }
143:
144:            /**
145:             * @param parameter sub-parameter to add
146:             * @return this instance
147:             */
148:            public MockParameter addParameter(final Parameter parameter) {
149:                subParameters.add(parameter);
150:                return this ;
151:            }
152:
153:            /**
154:             * @see org.java.plugin.registry.Extension.Parameter#getSuperParameter()
155:             */
156:            public Parameter getSuperParameter() {
157:                return super Parameter;
158:            }
159:
160:            /**
161:             * @param value the super parameter to set
162:             * @return this instance
163:             */
164:            public MockParameter setSuperParameter(final Parameter value) {
165:                super Parameter = value;
166:                return this ;
167:            }
168:
169:            /**
170:             * @see org.java.plugin.registry.Extension.Parameter#rawValue()
171:             */
172:            public String rawValue() {
173:                return rawValue;
174:            }
175:
176:            /**
177:             * @param raw raw parameter value
178:             * @param typed typed parameter value
179:             * @return this instance
180:             */
181:            public MockParameter setValue(final String raw, final Object typed) {
182:                rawValue = raw;
183:                typedValue = typed;
184:                return this ;
185:            }
186:
187:            /**
188:             * @see org.java.plugin.registry.Extension.Parameter#valueAsBoolean()
189:             */
190:            public Boolean valueAsBoolean() {
191:                return (Boolean) typedValue;
192:            }
193:
194:            /**
195:             * @see org.java.plugin.registry.Extension.Parameter#valueAsDate()
196:             */
197:            public Date valueAsDate() {
198:                return (Date) typedValue;
199:            }
200:
201:            /**
202:             * @see org.java.plugin.registry.Extension.Parameter#valueAsExtension()
203:             */
204:            public Extension valueAsExtension() {
205:                return (Extension) typedValue;
206:            }
207:
208:            /**
209:             * @see org.java.plugin.registry.Extension.Parameter#valueAsExtensionPoint()
210:             */
211:            public ExtensionPoint valueAsExtensionPoint() {
212:                return (ExtensionPoint) typedValue;
213:            }
214:
215:            /**
216:             * @see org.java.plugin.registry.Extension.Parameter#valueAsNumber()
217:             */
218:            public Number valueAsNumber() {
219:                return (Number) typedValue;
220:            }
221:
222:            /**
223:             * @see org.java.plugin.registry.Extension.Parameter#valueAsPluginDescriptor()
224:             */
225:            public PluginDescriptor valueAsPluginDescriptor() {
226:                return (PluginDescriptor) typedValue;
227:            }
228:
229:            /**
230:             * @see org.java.plugin.registry.Extension.Parameter#valueAsString()
231:             */
232:            public String valueAsString() {
233:                return (String) typedValue;
234:            }
235:
236:            /**
237:             * @see org.java.plugin.registry.Extension.Parameter#valueAsUrl()
238:             */
239:            public URL valueAsUrl() {
240:                return (URL) typedValue;
241:            }
242:
243:            /**
244:             * @see org.java.plugin.registry.Extension.Parameter#valueAsUrl(
245:             *      org.java.plugin.PathResolver)
246:             */
247:            public URL valueAsUrl(final PathResolver pathResolver) {
248:                return (URL) typedValue;
249:            }
250:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.