javax.naming
abstract public class: RefAddr [javadoc |
source]
java.lang.Object
javax.naming.RefAddr
All Implemented Interfaces:
java$io$Serializable
Direct Known Subclasses:
BinaryRefAddr, StringRefAddr
This class represents the address of a communications end-point.
It consists of a type that describes the communication mechanism
and an address contents determined by an RefAddr subclass.
For example, an address type could be "BSD Printer Address",
which specifies that it is an address to be used with the BSD printing
protocol. Its contents could be the machine name identifying the
location of the printer server that understands this protocol.
A RefAddr is contained within a Reference.
RefAddr is an abstract class. Concrete implementations of it
determine its synchronization properties.
Field Summary |
---|
protected String | addrType | Contains the type of this address. |
Constructor: |
protected RefAddr(String addrType) {
this.addrType = addrType;
}
Constructs a new instance of RefAddr using its address type. Parameters:
addrType - A non-null string describing the type of the address.
|
Methods from java.lang.Object: |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method from javax.naming.RefAddr Detail: |
public boolean equals(Object obj) {
if ((obj != null) && (obj instanceof RefAddr)) {
RefAddr target = (RefAddr)obj;
if (addrType.compareTo(target.addrType) == 0) {
Object thisobj = this.getContent();
Object thatobj = target.getContent();
if (thisobj == thatobj)
return true;
if (thisobj != null)
return thisobj.equals(thatobj);
}
}
return false;
}
|
abstract public Object getContent()
Retrieves the contents of this address. |
public String getType() {
return addrType;
}
Retrieves the address type of this address. |
public int hashCode() {
return (getContent() == null)
? addrType.hashCode()
: addrType.hashCode() + getContent().hashCode();
}
Computes the hash code of this address using its address type and contents.
The hash code is the sum of the hash code of the address type and
the hash code of the address contents. |
public String toString() {
StringBuffer str = new StringBuffer("Type: " + addrType + "\n");
str.append("Content: " + getContent() + "\n");
return (str.toString());
}
Generates the string representation of this address.
The string consists of the address's type and contents with labels.
This representation is intended for display only and not to be parsed. |