Source Code Cross Referenced for ConfigurationAdapter.java in  » Scripting » Pnuts » pnuts » ext » 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 » Scripting » Pnuts » pnuts.ext 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * @(#)ConfigurationAdapter.java 1.2 04/12/06
003:         * 
004:         * Copyright (c) 1997-2004 Sun Microsystems, Inc. All Rights Reserved.
005:         * 
006:         * See the file "LICENSE.txt" for information on usage and redistribution of
007:         * this file, and for a DISCLAIMER OF ALL WARRANTIES.
008:         */
009:        package pnuts.ext;
010:
011:        import java.lang.reflect.Constructor;
012:        import java.lang.reflect.Method;
013:        import java.util.Enumeration;
014:        import java.util.Map;
015:
016:        import pnuts.lang.Configuration;
017:        import pnuts.lang.Context;
018:        import pnuts.lang.Callable;
019:
020:        /*
021:         * This class is used to customize an existing configuraion.
022:         */
023:        public class ConfigurationAdapter extends Configuration {
024:
025:            protected Configuration base;
026:
027:            /**
028:             * Constructor
029:             */
030:            public ConfigurationAdapter() {
031:                this (normalConfiguration);
032:            }
033:
034:            /**
035:             * Constructor
036:             * 
037:             * @param base
038:             *            the base configuration
039:             */
040:            public ConfigurationAdapter(Configuration base) {
041:                this .base = base;
042:            }
043:
044:            /**
045:             * Returns the parent configuration
046:             */
047:            public Configuration getParent() {
048:                return base;
049:            }
050:
051:            /**
052:             * Gets a field of the specified class.
053:             * 
054:             * @param target
055:             *            the target objecgt
056:             * @param name
057:             *            the field name
058:             * @param context
059:             *            the context in which the field is read
060:             */
061:            public Object getField(Context context, Object target, String name) {
062:                return base.getField(context, target, name);
063:            }
064:
065:            /**
066:             * Sets a field of the specified class.
067:             * 
068:             * @param context
069:             *            the context in which the field is written.
070:             * @param target
071:             *            the target objecgt
072:             * @param name
073:             *            the field name
074:             * @param value
075:             *            the field value
076:             */
077:            public void putField(Context context, Object target, String name,
078:                    Object value) {
079:                base.putField(context, target, name, value);
080:            }
081:
082:            /**
083:             * Get the value of a static field.
084:             * 
085:             * @param context
086:             *            the context in which the field is accessed
087:             * @param clazz
088:             *            the class in which the static field is defined
089:             * @param name
090:             *            the name of the static field
091:             * @return the value
092:             */
093:            public Object getStaticField(Context context, Class clazz,
094:                    String name) {
095:                return base.getStaticField(context, clazz, name);
096:            }
097:
098:            /**
099:             * Sets a field of the specified class.
100:             * 
101:             * @param context
102:             *            the context in which the field is written.
103:             * @param clazz
104:             *            the class in which the static field is defined
105:             * @param name
106:             *            the field name
107:             * @param value
108:             *            the field value
109:             */
110:            public void putStaticField(Context context, Class clazz,
111:                    String name, Object value) {
112:                base.putStaticField(context, clazz, name, value);
113:            }
114:
115:            /**
116:             * Call a method.
117:             * 
118:             * @param context
119:             *            the context
120:             * @param c
121:             *            the class of the target object
122:             * @param name
123:             *            the name of the method
124:             * @param args
125:             *            the arguments
126:             * @param types
127:             *            the type information of arguments
128:             * @param target
129:             *            the target of the method call
130:             * 
131:             * @return the methods return value
132:             */
133:            public Object callMethod(Context context, Class c, String name,
134:                    Object args[], Class types[], Object target) {
135:                return base.callMethod(context, c, name, args, types, target);
136:            }
137:
138:            /**
139:             * Call a constructor.
140:             * 
141:             * @param args
142:             *            the arguments
143:             * 
144:             * @return the newly created and initialized object
145:             */
146:            public Object callConstructor(Context context, Class c,
147:                    Object[] args, Class[] types) {
148:                return base.callConstructor(context, c, args, types);
149:            }
150:
151:            /**
152:             * Gets an array element
153:             * 
154:             * @param target
155:             *            the target object (an array)
156:             * @param key
157:             *            a key or an index of the element
158:             * @param context
159:             *            the context
160:             * @return the value of the element
161:             */
162:            public Object getElement(Context context, Object target, Object key) {
163:                return base.getElement(context, target, key);
164:            }
165:
166:            /**
167:             * Sets an array element
168:             * 
169:             * @param target
170:             *            the target object (an array)
171:             * @param key
172:             *            a key or an index of the element
173:             * @param value
174:             *            the new value of the element
175:             * @param context
176:             *            the context
177:             */
178:            public void setElement(Context context, Object target, Object key,
179:                    Object value) {
180:                base.setElement(context, target, key, value);
181:            }
182:
183:            /**
184:             * Get all public methods of the specified class.
185:             * 
186:             * @param cls
187:             *            the class
188:             * @return an array of Method objects
189:             */
190:            public Method[] getMethods(Class cls) {
191:                return base.getMethods(cls);
192:            }
193:
194:            /**
195:             * Get all public constructors of the specified class.
196:             * 
197:             * @param cls
198:             *            the class
199:             * @return an array of Constructor objects
200:             */
201:            public Constructor[] getConstructors(Class cls) {
202:                return base.getConstructors(cls);
203:            }
204:
205:            /**
206:             * Convert an object to Enumeration. This method is used by foreach
207:             * statements. Subclasses can override this method to customize the behavior
208:             * of foreach statements.
209:             */
210:            public Enumeration toEnumeration(Object obj) {
211:                return base.toEnumeration(obj);
212:            }
213:
214:            /**
215:             * Convert an object to Callable. This method is used by call expression, e.g. obj(arg1, ...).
216:             * Subclasses can override this method to register custom callable objects.
217:             */
218:            public Callable toCallable(Object obj) {
219:                return base.toCallable(obj);
220:            }
221:
222:            /**
223:             * Handle an "not.defined" error
224:             * 
225:             * This method can be redefined by a subclass so that a special value (e.g.
226:             * null) is returned when undefined symbol is referenced.
227:             * 
228:             * @param symbol
229:             *            the undefined symbol
230:             * @param context
231:             *            the context in which the symbol is referenced
232:             * @return the value to be returned
233:             */
234:            public Object handleUndefinedSymbol(String symbol, Context context) {
235:                return base.handleUndefinedSymbol(symbol, context);
236:            }
237:
238:            /**
239:             * Return the value of an array expression. e.g. [a,b,c] {1,2,3}
240:             * 
241:             * This method can be redefined by a subclass so that array expression
242:             * returns different type of object, such as java.util.List.
243:             * 
244:             * @param array the elements in the array expression
245:             * @param context the context
246:             * @return the value of the array expression
247:             */
248:            public Object makeArray(Object[] array, Context context) {
249:                return base.makeArray(array, context);
250:            }
251:
252:            /**
253:             * Create a new Map object that corresponds to {key=>value} expression.
254:             * 
255:             * @param size
256:             *            the map size
257:             * @return a new Map object
258:             */
259:            public Map createMap(int size, Context context) {
260:                return base.createMap(size, context);
261:            }
262:
263:            /**
264:             * String representation of an object
265:             * 
266:             * @param target the target object to print
267:             * @return the string representation of the target object
268:             */
269:            public String formatObject(Object target) {
270:                return base.formatObject(target);
271:            }
272:
273:            /**
274:             * Defines the semantices of an expression like: <blockquote>
275:             * 
276:             * <pre>
277:             * 
278:             *  target[idx1..idx2]
279:             *  
280:             * </pre>
281:             * 
282:             * </blockquote>
283:             * 
284:             * @param context
285:             *            the context
286:             * @param target
287:             *            the target object
288:             * @param idx1
289:             *            the start index
290:             * @param idx2
291:             *            the end index. null in idx2 means open-ended.
292:             * @return the result
293:             */
294:            public Object getRange(Context context, Object target, Object idx1,
295:                    Object idx2) {
296:                return base.getRange(context, target, idx1, idx2);
297:            }
298:
299:            /**
300:             * Defines the semantices of an expression like: <blockquote>
301:             * 
302:             * <pre>
303:             * 
304:             *  target[idx1..idx2] = value
305:             *  
306:             * </pre>
307:             * 
308:             * </blockquote>
309:             * 
310:             * @param context
311:             *            the context in which the assignment is done
312:             * @param target
313:             *            the target object
314:             * @param idx1
315:             *            the start index
316:             * @param idx2
317:             *            the end index. null in idx2 means open-ended.
318:             * @param value
319:             *            the new value of the indexed element
320:             * @return the result
321:             */
322:            public Object setRange(Context context, Object target, Object idx1,
323:                    Object idx2, Object value) {
324:                return base.setRange(context, target, idx1, idx2, value);
325:            }
326:
327:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.