Source Code Cross Referenced for FieldSurrogate.java in  » Byte-Code » PROSE » ch » ethz » prose » query » 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 » Byte Code » PROSE » ch.ethz.prose.query 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        //
002:        //  This file is part of the prose package.
003:        //
004:        //  The contents of this file are subject to the Mozilla Public License
005:        //  Version 1.1 (the "License"); you may not use this file except in
006:        //  compliance with the License. You may obtain a copy of the License at
007:        //  http://www.mozilla.org/MPL/
008:        //
009:        //  Software distributed under the License is distributed on an "AS IS" basis,
010:        //  WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
011:        //  for the specific language governing rights and limitations under the
012:        //  License.
013:        //
014:        //  The Original Code is prose.
015:        //
016:        //  The Initial Developer of the Original Code is Andrei Popovici. Portions
017:        //  created by Andrei Popovici are Copyright (C) 2002 Andrei Popovici.
018:        //  All Rights Reserved.
019:        //
020:        //  Contributor(s):
021:        // $Id: FieldSurrogate.java,v 1.1.1.1 2003/07/02 15:30:52 apopovic Exp $
022:        // =====================================================================
023:        //
024:        // (history at end)
025:        //
026:
027:        package ch.ethz.prose.query;
028:
029:        // used packages
030:        import java.lang.reflect.Field;
031:
032:        /**
033:         * Class FieldSurrogate represents a <code>Field</code> object.
034:         *
035:         * @version	$Revision: 1.1.1.1 $
036:         * @author	Philippe Schoch
037:         */
038:        public class FieldSurrogate extends Surrogate {
039:
040:            private static final long serialVersionUID = 4051045280784790578L;
041:            private String fieldName;
042:            private String fieldType;
043:            private int hashCode;
044:            private String declaringClassName;
045:
046:            /**
047:             * Constructs a new instance representing field <code>f</code>
048:             *
049:             * @param f the field to represent
050:             */
051:            public FieldSurrogate(Field f) {
052:                if (f == null)
053:                    throw new IllegalArgumentException(
054:                            "specified field must not be null");
055:
056:                hashCode = f.hashCode();
057:                fieldName = f.getName();
058:                fieldType = f.getType().getName();
059:                declaringClassName = f.getDeclaringClass().getName();
060:            }
061:
062:            /**
063:             * Return the name of the contained field.
064:             *
065:             * @return the name of the represented field.
066:             */
067:            public String getName() {
068:                return fieldName;
069:            }
070:
071:            /**
072:             * Return the type of the contained method
073:             *
074:             * @return the type of the represented method
075:             */
076:            public String getType() {
077:                return fieldType;
078:            }
079:
080:            public Object toRealInstance() throws ClassNotFoundException,
081:                    NoSuchFieldException {
082:                return toRealInstance(declaringClassName);
083:            }
084:
085:            /**
086:             * Returns a <code>Field</code> Object that is represented by this
087:             * <code>FieldSurrogate</code>.
088:             *
089:             * @exception ClassNotFoundException	can be thrown if the declaring class of the field is not found.
090:             * @exception NoSuchFieldException 	can be thrown if the name of the field doesn't represent a <code>Field</code>.
091:             */
092:            public Field toRealInstance(String className)
093:                    throws ClassNotFoundException, NoSuchFieldException {
094:                Class c = Class.forName(className);
095:                return c.getDeclaredField(fieldName);
096:            }
097:
098:            /**
099:             * Compares this instance with the passed object. Attention, this field has a
100:             * different semantic than the one in the <code>Field</code> class!!!
101:             *
102:             * @return <code>true</code> if the passed object is of type FieldSurrogate
103:             *          and has the same name and type.
104:             */
105:            public boolean equals(Object o) {
106:                if (!(o instanceof  FieldSurrogate))
107:                    return false;
108:
109:                FieldSurrogate other = (FieldSurrogate) o;
110:
111:                if (!this .getName().equals(other.getName()))
112:                    return false;
113:
114:                if (!this .getType().equals(other.getType()))
115:                    return false;
116:
117:                return true;
118:            }
119:
120:            public int hashCode() {
121:                return hashCode;
122:            }
123:
124:            /**
125:             * Returns a string describing this Field. The format is the field type followed by the field name.
126:             */
127:            public String toString() {
128:                return fieldType + " " + fieldName;
129:            }
130:        }
131:
132:        //======================================================================
133:        //
134:        // $Log: FieldSurrogate.java,v $
135:        // Revision 1.1.1.1  2003/07/02 15:30:52  apopovic
136:        // Imported from ETH Zurich
137:        //
138:        // Revision 1.3  2003/05/20 16:05:08  popovici
139:        //
140:        // New QueryManager replaces functionality in AspectManager (better Soc)
141:        // New 'Surrogate' classes for usage in the QueryManager
142:        // The 'RemoteAspectManager' and tools modified to use the Surrogates and the QueryManager
143:        //
144:        // Revision 1.2  2003/05/06 15:51:50  popovici
145:        // Mozilla-ification
146:        //
147:        // Revision 1.1  2003/05/05 13:58:22  popovici
148:        // renaming from runes to prose
149:        //
150:        // Revision 1.3  2003/04/17 15:14:57  popovici
151:        // Extension->Aspect renaming
152:        //
153:        // Revision 1.2  2003/03/04 18:36:02  popovici
154:        // Organization of imprts
155:        //
156:        // Revision 1.1  2003/01/17 14:43:57  pschoch
157:        // Introduction of 'query' methods in the AspectManager and its
158:        // subclasses.  The result set is given back in form of surrogates; 4 new tests added to ExtensionManagerTest
159:        // ExtensionSystemTest
160:        //
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.