FileDocCategorySizeDatePackage
ResolveResult.javaAPI DocJava SE 5 API5422Fri Aug 26 14:57:42 BST 2005javax.naming.spi

ResolveResult

public class ResolveResult extends Object implements Serializable
This class represents the result of resolution of a name. It contains the object to which name was resolved, and the portion of the name that has not been resolved.

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

author
Rosanna Lee
author
Scott Seligman
version
1.10 03/12/19
since
1.3

Fields Summary
protected Object
resolvedObj
Field containing the Object that was resolved to successfully. It can be null only when constructed using a subclass. Constructors should always initialize this.
protected Name
remainingName
Field containing the remaining name yet to be resolved. It can be null only when constructed using a subclass. Constructors should always initialize this.
private static final long
serialVersionUID
Constructors Summary
protected ResolveResult()
Constructs an instance of ResolveResult with the resolved object and remaining name both initialized to null.

	resolvedObj = null;
	remainingName = null;
    
public ResolveResult(Object robj, String rcomp)
Constructs a new instance of ResolveResult consisting of the resolved object and the remaining unresolved component.

param
robj The non-null object resolved to.
param
rcomp The single remaining name component that has yet to be resolved. Cannot be null (but can be empty).

	resolvedObj = robj;
	try {
	remainingName = new CompositeName(rcomp);
//	    remainingName.appendComponent(rcomp);
	} catch (InvalidNameException e) {
	    // ignore; shouldn't happen
	}
    
public ResolveResult(Object robj, Name rname)
Constructs a new instance of ResolveResult consisting of the resolved Object and the remaining name.

param
robj The non-null Object resolved to.
param
rname The non-null remaining name that has yet to be resolved.

	resolvedObj = robj;
	setRemainingName(rname);
    
Methods Summary
public voidappendRemainingComponent(java.lang.String name)
Adds a single component to the end of remaining name.

param
name The component to add. Can be null.
see
#getRemainingName
see
#appendRemainingName

	if (name != null) {
	    CompositeName rname = new CompositeName();
	    try {
		rname.add(name);
	    } catch (InvalidNameException e) {
		// ignore; shouldn't happen for empty composite name
	    }
	    appendRemainingName(rname);
	}
    
public voidappendRemainingName(javax.naming.Name name)
Adds components to the end of remaining name.

param
name The components to add. Can be null.
see
#getRemainingName
see
#setRemainingName
see
#appendRemainingComponent

//	System.out.println("appendingRemainingName: " + name.toString());
//	Exception e = new Exception();
//	e.printStackTrace();
	if (name != null) {
	    if (this.remainingName != null) {
		try {
		    this.remainingName.addAll(name);
		} catch (InvalidNameException e) {
		    // ignore; shouldn't happen for composite name
		}
	    } else {
		this.remainingName = (Name)(name.clone());
	    }
	}
    
public javax.naming.NamegetRemainingName()
Retrieves the remaining unresolved portion of the name.

return
The remaining unresolved portion of the name. Cannot be null but empty OK.
see
#appendRemainingName
see
#appendRemainingComponent
see
#setRemainingName

	return this.remainingName;
    
public java.lang.ObjectgetResolvedObj()
Retrieves the Object to which resolution was successful.

return
The Object to which resolution was successful. Cannot be null.
see
#setResolvedObj

	return this.resolvedObj;
    
public voidsetRemainingName(javax.naming.Name name)
Sets the remaining name field of this result to name. A copy of name is made so that modifying the copy within this ResolveResult does not affect name and vice versa.

param
name The name to set remaining name to. Cannot be null.
see
#getRemainingName
see
#appendRemainingName
see
#appendRemainingComponent

	if (name != null)
	    this.remainingName = (Name)(name.clone());
	else {
	    // ??? should throw illegal argument exception
	    this.remainingName = null;
	}
    
public voidsetResolvedObj(java.lang.Object obj)
Sets the resolved Object field of this result to obj.

param
obj The object to use for setting the resolved obj field. Cannot be null.
see
#getResolvedObj

	this.resolvedObj = obj;
	// ??? should check for null?