javax.naming
public class Reference extends Object implements Cloneable, Serializable
Referenceable
,
Serialized FormModifier and Type | Field and Description |
---|---|
protected Vector<RefAddr> |
addrs
The list of addresses, stored in this reference.
|
protected String |
classFactory
The name of the class factory to create an instance of the object,
referenced by this reference.
|
protected String |
classFactoryLocation
The location, from where the class factory should be loaded.
|
protected String |
className
The name of the class of the object, to that this reference refers.
|
Constructor and Description |
---|
Reference(String className)
Create a new reference that is referencting to the object of the
specified class.
|
Reference(String className,
RefAddr addr)
Create a new reference that is referencing to the object of the
specified class with the given address.
|
Reference(String className,
RefAddr addr,
String factoryClassName,
String factoryLocation)
Create a new reference that is referencing to the object of the
specified class, specifying the class and location of the factory that
produces these objects and also the address of this object.
|
Reference(String className,
String factoryClassName,
String factoryLocation)
Create a new reference that is referencing to the object of the
specified class, specifying the class and location of the factory that
produces these objects.
|
Modifier and Type | Method and Description |
---|---|
void |
add(int posn,
RefAddr addr)
Add the new address for this object at the given position of the
address list.
|
void |
add(RefAddr addr)
Appends the new object address to the end of the address list.
|
void |
clear()
Removes all defined addresses of the object.
|
Object |
clone()
This method may be called to create a new copy of the
Object.
|
boolean |
equals(Object obj)
Compares two addresses for equality, by value.
|
RefAddr |
get(int posn)
Get the address of this object at the given position.
|
RefAddr |
get(String addrType)
Get the given type of address for this object.
|
Enumeration<RefAddr> |
getAll()
Get the enumeration over all defined addresses of the object.
|
String |
getClassName()
Get the name of the class of the referenced object.
|
String |
getFactoryClassLocation()
Get the location of the factory class of the referenced object.
|
String |
getFactoryClassName()
Get the name of the factory class of the referenced object
|
int |
hashCode()
Get the hashcode of this reference.
|
Object |
remove(int posn)
Remove the address at the given position.
|
int |
size()
Return the number of the defined addresses.
|
String |
toString()
Return the string representation.
|
protected Vector<RefAddr> addrs
protected String classFactory
protected String classFactoryLocation
public Reference(String className)
public Reference(String className, RefAddr addr)
public Reference(String className, String factoryClassName, String factoryLocation)
className
- the object class namefactoryClassName
- the object factory class namefactoryLocation
- the object factory locationpublic Reference(String className, RefAddr addr, String factoryClassName, String factoryLocation)
className
- the object class nameaddr
- the address of the objectfactoryClassName
- the object factory class namefactoryLocation
- the object factory locationpublic void add(int posn, RefAddr addr)
public void clear()
public Object clone()
Object
o == o.clone()
is falseo.getClass() == o.clone().getClass()
is trueo.equals(o)
is trueHowever, these are not strict requirements, and may
be violated if necessary. Of the three requirements, the
last is the most commonly violated, particularly if the
subclass does not override Object.equals(Object)
.
If the Object you call clone() on does not implement
Cloneable
(which is a placeholder interface), then
a CloneNotSupportedException is thrown. Notice that
Object does not implement Cloneable; this method exists
as a convenience for subclasses that do.
Object's implementation of clone allocates space for the new Object using the correct class, without calling any constructors, and then fills in all of the new field values with the old field values. Thus, it is a shallow copy. However, subclasses are permitted to make a deep copy.
All array types implement Cloneable, and override
this method as follows (it should never fail):
public Object clone() { try { super.clone(); } catch (CloneNotSupportedException e) { throw new InternalError(e.getMessage()); } }
public boolean equals(Object obj)
equals
in class Object
obj
- the Object to compare toObject.hashCode()
public RefAddr get(String addrType)
addrType
- the needed type of addresspublic Enumeration<RefAddr> getAll()
public String getClassName()
className
public String getFactoryClassLocation()
classFactoryLocation
public String getFactoryClassName()
classFactory
public int hashCode()
hashCode
in class Object
Object.equals(Object)
,
System.identityHashCode(Object)
public Object remove(int posn)
posn
- the position of the address to removepublic int size()
public String toString()
toString
in class Object
Object.getClass()
,
Object.hashCode()
,
Class.getName()
,
Integer.toHexString(int)