Source Code Cross Referenced for Binding.java in  » Apache-Harmony-Java-SE » javax-package » javax » naming » 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 » Apache Harmony Java SE » javax package » javax.naming 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* 
002:         * Licensed to the Apache Software Foundation (ASF) under one or more
003:         * contributor license agreements.  See the NOTICE file distributed with
004:         * this work for additional information regarding copyright ownership.
005:         * The ASF licenses this file to You under the Apache License, Version 2.0
006:         * (the "License"); you may not use this file except in compliance with
007:         * the License.  You may obtain a copy of the License at
008:         * 
009:         *     http://www.apache.org/licenses/LICENSE-2.0
010:         * 
011:         * Unless required by applicable law or agreed to in writing, software
012:         * distributed under the License is distributed on an "AS IS" BASIS,
013:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         * See the License for the specific language governing permissions and
015:         * limitations under the License.
016:         */
017:
018:        package javax.naming;
019:
020:        /**
021:         * Binding extends <code>NameClassPair</code> to associate an object in a
022:         * naming service with its name, specified class name and relative flag. As with
023:         * <code>NameClassPair</code>, a class name is only specified when it is
024:         * necessary to override the real class name of the associated object.
025:         * <p>
026:         * Multithreaded access to a <code>Binding</code> instance is only safe when
027:         * client code locks the object first.
028:         * </p>
029:         */
030:        public class Binding extends NameClassPair {
031:
032:            private static final long serialVersionUID = 8839217842691845890L;
033:
034:            private Object boundObj;
035:
036:            /**
037:             * Construct a <code>Binding</code> from a name and a class. Relative flag
038:             * is true.
039:             * 
040:             * @param name
041:             *            a name, may not be <code>null</code>.
042:             * @param obj
043:             *            an object bound with the name, may be <code>null</code>.
044:             */
045:            public Binding(String name, Object obj) {
046:                this (name, null, obj, true);
047:            }
048:
049:            /**
050:             * Construct a <code>Binding</code> from a name, an object and a relative
051:             * flag.
052:             * 
053:             * @param name
054:             *            a name, which may not be <code>null</code>.
055:             * @param obj
056:             *            an object bound with the name, may be <code>null</code>.
057:             * @param relative
058:             *            a relative flag
059:             */
060:            public Binding(String name, Object obj, boolean relative) {
061:                this (name, null, obj, relative);
062:            }
063:
064:            /**
065:             * Construct a <code>Binding</code> from a name, a class, and an object.
066:             * The class and object parameters may be null. Relative flag is true.
067:             * 
068:             * @param name
069:             *            a name, which may not be <code>null</code>.
070:             * @param className
071:             *            a class name, may be <code>null</code>.
072:             * @param obj
073:             *            an object bound with the name, may be <code>null</code>.
074:             */
075:            public Binding(String name, String className, Object obj) {
076:                this (name, className, obj, true);
077:            }
078:
079:            /**
080:             * Construct a <code>Binding</code> from a name, a class, an object and a
081:             * relative flag. The class and object parameters may be null.
082:             * 
083:             * @param name
084:             *            a name, which may not be <code>null</code>.
085:             * @param className
086:             *            a class name, may be <code>null</code>.
087:             * @param obj
088:             *            an object bound with the name, may be <code>null</code>.
089:             * @param relative
090:             *            a relative flag
091:             */
092:            public Binding(String name, String className, Object obj,
093:                    boolean relative) {
094:                super (name, className, relative);
095:                this .boundObj = obj;
096:            }
097:
098:            /**
099:             * Get the class name of this <code>Binding</code>. It may have been
100:             * specified, in which case the class name field is set, and that is the
101:             * string returned by this method. If the class name field has not been
102:             * specified then the object associated with this <code>Binding</code> is
103:             * interrogated to find its actual class name. If there is no class name
104:             * field specified and no associated object then this method returns null.
105:             * 
106:             * @return the class name
107:             */
108:            @Override
109:            public String getClassName() {
110:                if (super .getClassName() != null) {
111:                    return super .getClassName();
112:                }
113:                if (boundObj != null) {
114:                    return boundObj.getClass().getName();
115:                }
116:                return null;
117:            }
118:
119:            /**
120:             * Get the object associated with this <code>Binding</code>. May return
121:             * null.
122:             * 
123:             * @return the object associated with this <code>Binding</code>. May
124:             *         return null.
125:             */
126:            public Object getObject() {
127:                return boundObj;
128:            }
129:
130:            /**
131:             * Set the object o associated with this <code>Binding</code>. The object
132:             * may be null.
133:             * 
134:             * @param object
135:             *            an object
136:             */
137:            public void setObject(Object object) {
138:                this .boundObj = object;
139:            }
140:
141:            /**
142:             * Provide a string representation of this object. This is the same as for
143:             * <code>NameClassPair</code> but with the string representation of the
144:             * <code>Binding</code> object appended to the end.
145:             * 
146:             * @return a string representation of this <code>Binding</code>
147:             */
148:            @Override
149:            public String toString() {
150:                return super .toString() + ":" + boundObj; //$NON-NLS-1$
151:            }
152:
153:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.