APIdia Launch Partner
Top Description Fields Constructors Methods
javax.naming.directory

public Class SearchResult

extends Binding
Class Inheritance
Known Direct Subclasses
com.sun.jndi.ldap.SearchResultWithControls
Imports
javax.naming.Binding

This class represents an item in the NamingEnumeration returned as a result of the DirContext.search() methods.

A SearchResult instance is not synchronized against concurrent multithreaded access. Multiple threads trying to access and modify a single SearchResult instance should lock the object.

Authors
Rosanna Lee, Scott Seligman
Since
1.3
See Also
DirContext#search

Field Summary

Modifier and TypeField and Description
private Attributes
attrs

Contains the attributes returned with the object.

private static final long
serialVersionUID

Hides javax.naming.Binding.serialVersionUID.

Use serialVersionUID from JNDI 1.1.1 for interoperability

Constructor Summary

AccessConstructor and Description
public
SearchResult(String
The non-null name of the search item. It is relative to the target context of the search (which is named by the first parameter of the search() method)
name
,
Object
The object bound to name. Can be null.
obj
,
Attributes
The attributes that were requested to be returned with this search item. Cannot be null.
attrs
)

Constructs a search result using the result's name, its bound object, and its attributes.

public
SearchResult(String
The non-null name of the search item.
name
,
Object
The object bound to name. Can be null.
obj
,
Attributes
The attributes that were requested to be returned with this search item. Cannot be null.
attrs
,
boolean
true if name is relative to the target context of the search (which is named by the first parameter of the search() method); false if name is a URL string.
isRelative
)

Constructs a search result using the result's name, its bound object, and its attributes, and whether the name is relative.

public
SearchResult(String
The non-null name of the search item. It is relative to the target context of the search (which is named by the first parameter of the search() method)
name
,
String
The possibly null class name of the object bound to name. If null, the class name of obj is returned by getClassName(). If obj is also null, getClassName() will return null.
className
,
Object
The object bound to name. Can be null.
obj
,
Attributes
The attributes that were requested to be returned with this search item. Cannot be null.
attrs
)

Constructs a search result using the result's name, its class name, its bound object, and its attributes.

public
SearchResult(String
The non-null name of the search item.
name
,
String
The possibly null class name of the object bound to name. If null, the class name of obj is returned by getClassName(). If obj is also null, getClassName() will return null.
className
,
Object
The object bound to name. Can be null.
obj
,
Attributes
The attributes that were requested to be returned with this search item. Cannot be null.
attrs
,
boolean
true if name is relative to the target context of the search (which is named by the first parameter of the search() method); false if name is a URL string.
isRelative
)

Constructs a search result using the result's name, its class name, its bound object, its attributes, and whether the name is relative.

Method Summary

Modifier and TypeMethod and Description
public Attributes

Returns:

The non-null attributes in this search result. Can be empty.
getAttributes
()

Retrieves the attributes in this search result.

public void
setAttributes(Attributes
The non-null attributes to use. Can be empty.
attrs
)

Sets the attributes of this search result to attrs.

public String

Returns:

The string representation of this SearchResult. Cannot be null.
toString
()

Overrides javax.naming.Binding.toString.

Generates the string representation of this SearchResult.

Inherited from javax.naming.Binding:
getClassNamegetObjectsetObject

Field Detail

attrsback to summary
private Attributes attrs

Contains the attributes returned with the object.

serialVersionUIDback to summary
private static final long serialVersionUID

Hides javax.naming.Binding.serialVersionUID.

Use serialVersionUID from JNDI 1.1.1 for interoperability

Constructor Detail

SearchResultback to summary
public SearchResult(String name, Object obj, Attributes attrs)

Constructs a search result using the result's name, its bound object, and its attributes.

getClassName() will return the class name of obj (or null if obj is null) unless the class name has been explicitly set using setClassName().

Parameters
name:String

The non-null name of the search item. It is relative to the target context of the search (which is named by the first parameter of the search() method)

obj:Object

The object bound to name. Can be null.

attrs:Attributes

The attributes that were requested to be returned with this search item. Cannot be null.

See Also
javax.naming.NameClassPair#setClassName, javax.naming.NameClassPair#getClassName
SearchResultback to summary
public SearchResult(String name, Object obj, Attributes attrs, boolean isRelative)

Constructs a search result using the result's name, its bound object, and its attributes, and whether the name is relative.

getClassName() will return the class name of obj (or null if obj is null) unless the class name has been explicitly set using setClassName()

Parameters
name:String

The non-null name of the search item.

obj:Object

The object bound to name. Can be null.

attrs:Attributes

The attributes that were requested to be returned with this search item. Cannot be null.

isRelative:boolean

true if name is relative to the target context of the search (which is named by the first parameter of the search() method); false if name is a URL string.

See Also
javax.naming.NameClassPair#setClassName, javax.naming.NameClassPair#getClassName
SearchResultback to summary
public SearchResult(String name, String className, Object obj, Attributes attrs)

Constructs a search result using the result's name, its class name, its bound object, and its attributes.

Parameters
name:String

The non-null name of the search item. It is relative to the target context of the search (which is named by the first parameter of the search() method)

className:String

The possibly null class name of the object bound to name. If null, the class name of obj is returned by getClassName(). If obj is also null, getClassName() will return null.

obj:Object

The object bound to name. Can be null.

attrs:Attributes

The attributes that were requested to be returned with this search item. Cannot be null.

See Also
javax.naming.NameClassPair#setClassName, javax.naming.NameClassPair#getClassName
SearchResultback to summary
public SearchResult(String name, String className, Object obj, Attributes attrs, boolean isRelative)

Constructs a search result using the result's name, its class name, its bound object, its attributes, and whether the name is relative.

Parameters
name:String

The non-null name of the search item.

className:String

The possibly null class name of the object bound to name. If null, the class name of obj is returned by getClassName(). If obj is also null, getClassName() will return null.

obj:Object

The object bound to name. Can be null.

attrs:Attributes

The attributes that were requested to be returned with this search item. Cannot be null.

isRelative:boolean

true if name is relative to the target context of the search (which is named by the first parameter of the search() method); false if name is a URL string.

See Also
javax.naming.NameClassPair#setClassName, javax.naming.NameClassPair#getClassName

Method Detail

getAttributesback to summary
public Attributes getAttributes()

Retrieves the attributes in this search result.

Returns:Attributes

The non-null attributes in this search result. Can be empty.

See Also
setAttributes
setAttributesback to summary
public void setAttributes(Attributes attrs)

Sets the attributes of this search result to attrs.

Parameters
attrs:Attributes

The non-null attributes to use. Can be empty.

See Also
getAttributes
toStringback to summary
public String toString()

Overrides javax.naming.Binding.toString.

Generates the string representation of this SearchResult. The string representation consists of the string representation of the binding and the string representation of this search result's attributes, separated by ':'. The contents of this string is useful for debugging and is not meant to be interpreted programmatically.

Returns:String

The string representation of this SearchResult. Cannot be null.