Source Code Cross Referenced for SearchResult.java in  » 6.0-JDK-Core » naming » javax » naming » directory » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Home
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
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Net
51.Parser
52.PDF
53.Portal
54.Profiler
55.Project Management
56.Report
57.RSS RDF
58.Rule Engine
59.Science
60.Scripting
61.Search Engine
62.Security
63.Sevlet Container
64.Source Control
65.Swing Library
66.Template Engine
67.Test Coverage
68.Testing
69.UML
70.Web Crawler
71.Web Framework
72.Web Mail
73.Web Server
74.Web Services
75.Web Services apache cxf 2.2.6
76.Web Services AXIS2
77.Wiki Engine
78.Workflow Engines
79.XML
80.XML UI
Java Source Code / Java Documentation » 6.0 JDK Core » naming » javax.naming.directory 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001        /*
002         * Copyright 1999-2000 Sun Microsystems, Inc.  All Rights Reserved.
003         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004         *
005         * This code is free software; you can redistribute it and/or modify it
006         * under the terms of the GNU General Public License version 2 only, as
007         * published by the Free Software Foundation.  Sun designates this
008         * particular file as subject to the "Classpath" exception as provided
009         * by Sun in the LICENSE file that accompanied this code.
010         *
011         * This code is distributed in the hope that it will be useful, but WITHOUT
012         * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013         * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
014         * version 2 for more details (a copy is included in the LICENSE file that
015         * accompanied this code).
016         *
017         * You should have received a copy of the GNU General Public License version
018         * 2 along with this work; if not, write to the Free Software Foundation,
019         * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020         *
021         * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022         * CA 95054 USA or visit www.sun.com if you need additional information or
023         * have any questions.
024         */
025
026        package javax.naming.directory;
027
028        import javax.naming.Binding;
029
030        /**
031         * This class represents an item in the NamingEnumeration returned as a
032         * result of the DirContext.search() methods.
033         *<p>
034         * A SearchResult instance is not synchronized against concurrent 
035         * multithreaded access. Multiple threads trying to access and modify
036         * a single SearchResult instance should lock the object.
037         *
038         * @author Rosanna Lee
039         * @author Scott Seligman
040         * @version 1.16 07/05/05
041         *
042         * @see DirContext#search
043         * @since 1.3
044         */
045
046        public class SearchResult extends Binding {
047            /**
048             * Contains the attributes returned with the object.
049             * @serial
050             */
051            private Attributes attrs;
052
053            /**
054             * Constructs a search result using the result's name, its bound object, and
055             * its attributes.
056             *<p>
057             * <tt>getClassName()</tt> will return the class name of <tt>obj</tt> 
058             * (or null if <tt>obj</tt> is null) unless the class name has been
059             * explicitly set using <tt>setClassName()</tt>. 
060             *
061             * @param name The non-null name of the search item. It is relative
062             *             to the <em>target context</em> of the search (which is 
063             * named by the first parameter of the <code>search()</code> method)
064             *
065             * @param obj  The object bound to name. Can be null.
066             * @param attrs The attributes that were requested to be returned with 
067             * this search item. Cannot be null.
068             * @see javax.naming.NameClassPair#setClassName
069             * @see javax.naming.NameClassPair#getClassName
070             */
071            public SearchResult(String name, Object obj, Attributes attrs) {
072                super (name, obj);
073                this .attrs = attrs;
074            }
075
076            /**
077             * Constructs a search result using the result's name, its bound object, and
078             * its attributes, and whether the name is relative.
079             *<p>
080             * <tt>getClassName()</tt> will return the class name of <tt>obj</tt> 
081             * (or null if <tt>obj</tt> is null) unless the class name has been
082             * explicitly set using <tt>setClassName()</tt>
083             *
084             * @param name The non-null name of the search item.
085             * @param obj  The object bound to name. Can be null.
086             * @param attrs The attributes that were requested to be returned with 
087             * this search item. Cannot be null.
088             * @param isRelative true if <code>name</code> is relative
089             *		to the target context of the search (which is named by
090             *         the first parameter of the <code>search()</code> method);
091             *         false if <code>name</code> is a URL string.
092             * @see javax.naming.NameClassPair#setClassName
093             * @see javax.naming.NameClassPair#getClassName
094             */
095            public SearchResult(String name, Object obj, Attributes attrs,
096                    boolean isRelative) {
097                super (name, obj, isRelative);
098                this .attrs = attrs;
099            }
100
101            /**
102             * Constructs a search result using the result's name, its class name, 
103             * its bound object, and its attributes.
104             *
105             * @param name The non-null name of the search item. It is relative
106             *             to the <em>target context</em> of the search (which is 
107             * named by the first parameter of the <code>search()</code> method)
108             *
109             * @param	className	The possibly null class name of the object 
110             * 	bound to <tt>name</tt>. If null, the class name of <tt>obj</tt> is
111             *		returned by <tt>getClassName()</tt>. If <tt>obj</tt> is also null,
112             *		<tt>getClassName()</tt> will return null.
113             * @param obj  The object bound to name. Can be null.
114             * @param attrs The attributes that were requested to be returned with 
115             * this search item. Cannot be null.
116             * @see javax.naming.NameClassPair#setClassName
117             * @see javax.naming.NameClassPair#getClassName
118             */
119            public SearchResult(String name, String className, Object obj,
120                    Attributes attrs) {
121                super (name, className, obj);
122                this .attrs = attrs;
123            }
124
125            /**
126             * Constructs a search result using the result's name, its class name,
127             * its bound object, its attributes, and whether the name is relative.
128             *
129             * @param name The non-null name of the search item.
130             * @param	className	The possibly null class name of the object 
131             * 	bound to <tt>name</tt>. If null, the class name of <tt>obj</tt> is
132             *		returned by <tt>getClassName()</tt>. If <tt>obj</tt> is also null,
133             *		<tt>getClassName()</tt> will return null.
134             * @param obj  The object bound to name. Can be null.
135             * @param attrs The attributes that were requested to be returned with 
136             * this search item. Cannot be null.
137             * @param isRelative true if <code>name</code> is relative
138             *		to the target context of the search (which is named by
139             *         the first parameter of the <code>search()</code> method);
140             *         false if <code>name</code> is a URL string.
141             * @see javax.naming.NameClassPair#setClassName
142             * @see javax.naming.NameClassPair#getClassName
143             */
144            public SearchResult(String name, String className, Object obj,
145                    Attributes attrs, boolean isRelative) {
146                super (name, className, obj, isRelative);
147                this .attrs = attrs;
148            }
149
150            /**
151             * Retrieves the attributes in this search result.
152             *
153             * @return The non-null attributes in this search result. Can be empty.
154             * @see #setAttributes
155             */
156            public Attributes getAttributes() {
157                return attrs;
158            }
159
160            /**
161             * Sets the attributes of this search result to <code>attrs</code>.
162             * @param attrs The non-null attributes to use. Can be empty.
163             * @see #getAttributes
164             */
165            public void setAttributes(Attributes attrs) {
166                this .attrs = attrs;
167                // ??? check for null?
168            }
169
170            /**
171             * Generates the string representation of this SearchResult.
172             * The string representation consists of the string representation
173             * of the binding and the string representation of
174             * this search result's attributes, separated by ':'.
175             * The contents of this string is useful
176             * for debugging and is not meant to be interpreted programmatically.
177             *
178             * @return The string representation of this SearchResult. Cannot be null.
179             */
180            public String toString() {
181                return super .toString() + ":" + getAttributes();
182            }
183
184            /**
185             * Use serialVersionUID from JNDI 1.1.1 for interoperability
186             */
187            private static final long serialVersionUID = -9158063327699723172L;
188        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.