Source Code Cross Referenced for AbstractFieldValue.java in  » Database-ORM » MMBase » org » mmbase » bridge » util » 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 » Database ORM » MMBase » org.mmbase.bridge.util 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:
003:        This software is OSI Certified Open Source Software.
004:        OSI Certified is a certification mark of the Open Source Initiative.
005:
006:        The license (Mozilla version 1.0) can be read at the MMBase site.
007:        See http://www.MMBase.org/license
008:
009:         */
010:
011:        package org.mmbase.bridge.util;
012:
013:        import org.mmbase.bridge.*;
014:        import org.mmbase.util.Casting;
015:        import org.w3c.dom.Document;
016:        import org.w3c.dom.Element;
017:        import java.util.*;
018:
019:        /**
020:         * This implementation of the Field Value interface is used by getFunctionValue of Node. This
021:         * represents the result of a `function' on a node and it (therefore) is an unmodifiable.
022:         *
023:         * @author  Michiel Meeuwissen
024:         * @version $Id: AbstractFieldValue.java,v 1.4 2007/02/16 20:06:13 michiel Exp $
025:         * @since   MMBase-1.8
026:         */
027:        public abstract class AbstractFieldValue implements  FieldValue {
028:
029:            static protected BridgeException CANNOTCHANGE = new BridgeException(
030:                    "Cannot change function value");
031:
032:            protected final Node node;
033:            protected final Cloud cloud;
034:
035:            protected AbstractFieldValue(Node n, Cloud c) {
036:                node = n;
037:                cloud = c != null ? c : (n != null ? n.getCloud() : null);
038:            }
039:
040:            /**
041:             * Function values cannot be changed
042:             * @return false
043:             */
044:            public boolean canModify() {
045:                return false;
046:            }
047:
048:            public boolean isNull() {
049:                return get() == null;
050:            }
051:
052:            public abstract Object get();
053:
054:            public Field getField() {
055:                return null;
056:            }
057:
058:            public Node getNode() {
059:                return node;
060:            }
061:
062:            public boolean toBoolean() {
063:                return Casting.toBoolean(get());
064:            }
065:
066:            public byte[] toByte() {
067:                return Casting.toByte(get());
068:            }
069:
070:            public float toFloat() {
071:                return Casting.toFloat(get());
072:            }
073:
074:            public double toDouble() {
075:                return Casting.toDouble(get());
076:            }
077:
078:            public long toLong() {
079:                return Casting.toLong(get());
080:            }
081:
082:            public int toInt() {
083:                return Casting.toInt(get());
084:            }
085:
086:            public Node toNode() {
087:                return Casting.toNode(get(), cloud);
088:            }
089:
090:            @Override
091:            public String toString() {
092:                return Casting.toString(get());
093:            }
094:
095:            public Document toXML() throws IllegalArgumentException {
096:                return Casting.toXML(get());
097:            }
098:
099:            public final Element toXML(Document tree)
100:                    throws IllegalArgumentException {
101:                Document doc = toXML();
102:                if (doc == null)
103:                    return null;
104:                return (Element) tree
105:                        .importNode(doc.getDocumentElement(), true);
106:            }
107:
108:            /**
109:             * @since MMBase-1.8
110:             */
111:            public Date toDate() {
112:                return Casting.toDate(get());
113:            }
114:
115:            /**
116:             * Function values cannot be changed, and all set-functions throw an exception.
117:             * @param value set value
118:             * @throws BridgeException
119:             */
120:            public void set(Object value) {
121:                throw CANNOTCHANGE;
122:            }
123:
124:            public void setObject(Object value) {
125:                throw CANNOTCHANGE;
126:            }
127:
128:            /**
129:             * Function values cannot be changed, and all set-functions throw an exception.
130:             * @param value set value
131:             * @throws BridgeException
132:             */
133:            public void setBoolean(boolean value) {
134:                throw CANNOTCHANGE;
135:            }
136:
137:            /**
138:             * Function values cannot be changed, and all set-functions throw an exception.
139:             * @param value set value
140:             * @throws BridgeException
141:             */
142:            public void setFLoat(float value) {
143:                throw CANNOTCHANGE;
144:            }
145:
146:            /**
147:             * Function values cannot be changed, and all set-functions throw an exception.
148:             * @param value set value
149:             * @throws BridgeException
150:             */
151:            public void setDouble(double value) {
152:                throw CANNOTCHANGE;
153:            }
154:
155:            /**
156:             * Function values cannot be changed, and all set-functions throw an exception.
157:             * @param value set value
158:             * @throws BridgeException
159:             */
160:            public void setLong(long value) {
161:                throw CANNOTCHANGE;
162:            }
163:
164:            /**
165:             * Function values cannot be changed, and all set-functions throw an exception.
166:             * @param value set value
167:             * @throws BridgeException
168:             */
169:            public void setInt(int value) {
170:                throw CANNOTCHANGE;
171:            }
172:
173:            /**
174:             * Function values cannot be changed, and all set-functions throw an exception.
175:             * @param value set value
176:             * @throws BridgeException
177:             */
178:            public void setByte(byte[] value) {
179:                throw CANNOTCHANGE;
180:            }
181:
182:            /**
183:             * Function values cannot be changed, and all set-functions throw an exception.
184:             * @param value set value
185:             * @throws BridgeException
186:             */
187:            public void setString(String value) {
188:                throw CANNOTCHANGE;
189:            }
190:
191:            /**
192:             * Function values cannot be changed, and all set-functions throw an exception.
193:             * @param value set value
194:             * @throws BridgeException
195:             */
196:            public void setNode(Node value) {
197:                throw CANNOTCHANGE;
198:            }
199:
200:            /**
201:             * Function values cannot be changed, and all set-functions throw an exception.
202:             * @param value set value
203:             * @throws BridgeException
204:             */
205:            public void setXML(Document value) {
206:                throw CANNOTCHANGE;
207:            }
208:
209:            /**
210:             * Function values cannot be changed, and all set-functions throw an exception.
211:             * @throws BridgeException
212:             * @since MMBase-1.8
213:             */
214:            public void setDate(Date value) {
215:                throw CANNOTCHANGE;
216:            }
217:
218:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.