* #### className
protected [String](../../../java.base/java/lang/String.html "class in java.lang") className
Contains the fully-qualified name of the class of the object to which this Reference refers.
See Also:
[Class.getName()](../../../java.base/java/lang/Class.html#getName%28%29)
* #### addrs
protected [Vector](../../../java.base/java/util/Vector.html "class in java.util")<[RefAddr](RefAddr.html "class in javax.naming")> addrs
Contains the addresses contained in this Reference. Initialized by constructor.
* #### classFactory
protected [String](../../../java.base/java/lang/String.html "class in java.lang") classFactory
Contains the name of the factory class for creating an instance of the object to which this Reference refers. Initialized to null.
* #### classFactoryLocation
protected [String](../../../java.base/java/lang/String.html "class in java.lang") classFactoryLocation
Contains the location of the factory class. Initialized to null.
Constructor Detail
* #### Reference
public Reference([String](../../../java.base/java/lang/String.html "class in java.lang") className)
Constructs a new reference for an object with class name 'className'. Class factory and class factory location are set to null. The newly created reference contains zero addresses.
Parameters:
`className` \- The non-null class name of the object to which this reference refers.
* #### Reference
public Reference([String](../../../java.base/java/lang/String.html "class in java.lang") className,
[RefAddr](RefAddr.html "class in javax.naming") addr)
Constructs a new reference for an object with class name 'className' and an address. Class factory and class factory location are set to null.
Parameters:
`className` \- The non-null class name of the object to which this reference refers.
`addr` \- The non-null address of the object.
* #### Reference
public Reference([String](../../../java.base/java/lang/String.html "class in java.lang") className,
[String](../../../java.base/java/lang/String.html "class in java.lang") factory,
[String](../../../java.base/java/lang/String.html "class in java.lang") factoryLocation)
Constructs a new reference for an object with class name 'className', and the class name and location of the object's factory.
Parameters:
`className` \- The non-null class name of the object to which this reference refers.
`factory` \- The possibly null class name of the object's factory.
`factoryLocation` \- The possibly null location from which to load the factory (e.g. URL)
See Also:
[ObjectFactory](spi/ObjectFactory.html "interface in javax.naming.spi"), [NamingManager.getObjectInstance(java.lang.Object, javax.naming.Name, javax.naming.Context, java.util.Hashtable<?, ?>)](spi/NamingManager.html#getObjectInstance%28java.lang.Object,javax.naming.Name,javax.naming.Context,java.util.Hashtable%29)
* #### Reference
public Reference([String](../../../java.base/java/lang/String.html "class in java.lang") className,
[RefAddr](RefAddr.html "class in javax.naming") addr,
[String](../../../java.base/java/lang/String.html "class in java.lang") factory,
[String](../../../java.base/java/lang/String.html "class in java.lang") factoryLocation)
Constructs a new reference for an object with class name 'className', the class name and location of the object's factory, and the address for the object.
Parameters:
`className` \- The non-null class name of the object to which this reference refers.
`factory` \- The possibly null class name of the object's factory.
`factoryLocation` \- The possibly null location from which to load the factory (e.g. URL)
`addr` \- The non-null address of the object.
See Also:
[ObjectFactory](spi/ObjectFactory.html "interface in javax.naming.spi"), [NamingManager.getObjectInstance(java.lang.Object, javax.naming.Name, javax.naming.Context, java.util.Hashtable<?, ?>)](spi/NamingManager.html#getObjectInstance%28java.lang.Object,javax.naming.Name,javax.naming.Context,java.util.Hashtable%29)
Method Detail
* #### getClassName
public [String](../../../java.base/java/lang/String.html "class in java.lang") getClassName()
Retrieves the class name of the object to which this reference refers.
Returns:
The non-null fully-qualified class name of the object. (e.g. "java.lang.String")
* #### getFactoryClassName
public [String](../../../java.base/java/lang/String.html "class in java.lang") getFactoryClassName()
Retrieves the class name of the factory of the object to which this reference refers.
Returns:
The possibly null fully-qualified class name of the factory. (e.g. "java.lang.String")
* #### getFactoryClassLocation
public [String](../../../java.base/java/lang/String.html "class in java.lang") getFactoryClassLocation()
Retrieves the location of the factory of the object to which this reference refers. If it is a codebase, then it is an ordered list of URLs, separated by spaces, listing locations from where the factory class definition should be loaded.
Returns:
The possibly null string containing the location for loading in the factory's class.
* #### get
public [RefAddr](RefAddr.html "class in javax.naming") get([String](../../../java.base/java/lang/String.html "class in java.lang") addrType)
Retrieves the first address that has the address type 'addrType'. String.compareTo() is used to test the equality of the address types.
Parameters:
`addrType` \- The non-null address type for which to find the address.
Returns:
The address in this reference with address type 'addrType'; null if no such address exists.
* #### get
public [RefAddr](RefAddr.html "class in javax.naming") get(int posn)
Retrieves the address at index posn.
Parameters:
`posn` \- The index of the address to retrieve.
Returns:
The address at the 0-based index posn. It must be in the range \[0,getAddressCount()).
Throws:
`[ArrayIndexOutOfBoundsException](../../../java.base/java/lang/ArrayIndexOutOfBoundsException.html "class in java.lang")` \- If posn not in the specified range.
* #### getAll
public [Enumeration](../../../java.base/java/util/Enumeration.html "interface in java.util")<[RefAddr](RefAddr.html "class in javax.naming")> getAll()
Retrieves an enumeration of the addresses in this reference. When addresses are added, changed or removed from this reference, its effects on this enumeration are undefined.
Returns:
An non-null enumeration of the addresses (`RefAddr`) in this reference. If this reference has zero addresses, an enumeration with zero elements is returned.
* #### size
public int size()
Retrieves the number of addresses in this reference.
Returns:
The nonnegative number of addresses in this reference.
* #### add
public void add([RefAddr](RefAddr.html "class in javax.naming") addr)
Adds an address to the end of the list of addresses.
Parameters:
`addr` \- The non-null address to add.
* #### add
public void add(int posn,
[RefAddr](RefAddr.html "class in javax.naming") addr)
Adds an address to the list of addresses at index posn. All addresses at index posn or greater are shifted up the list by one (away from index 0).
Parameters:
`posn` \- The 0-based index of the list to insert addr.
`addr` \- The non-null address to add.
Throws:
`[ArrayIndexOutOfBoundsException](../../../java.base/java/lang/ArrayIndexOutOfBoundsException.html "class in java.lang")` \- If posn not in the specified range.
* #### remove
public [Object](../../../java.base/java/lang/Object.html "class in java.lang") remove(int posn)
Deletes the address at index posn from the list of addresses. All addresses at index greater than posn are shifted down the list by one (towards index 0).
Parameters:
`posn` \- The 0-based index of in address to delete.
Returns:
The address removed.
Throws:
`[ArrayIndexOutOfBoundsException](../../../java.base/java/lang/ArrayIndexOutOfBoundsException.html "class in java.lang")` \- If posn not in the specified range.
* #### clear
public void clear()
Deletes all addresses from this reference.
* #### equals
public boolean equals([Object](../../../java.base/java/lang/Object.html "class in java.lang") obj)
Determines whether obj is a reference with the same addresses (in same order) as this reference. The addresses are checked using RefAddr.equals(). In addition to having the same addresses, the Reference also needs to have the same class name as this reference. The class factory and class factory location are not checked. If obj is null or not an instance of Reference, null is returned.
Overrides:
`[equals](../../../java.base/java/lang/Object.html#equals%28java.lang.Object%29)` in class `[Object](../../../java.base/java/lang/Object.html "class in java.lang")`
Parameters:
`obj` \- The possibly null object to check.
Returns:
true if obj is equal to this reference; false otherwise.
See Also:
[Object.hashCode()](../../../java.base/java/lang/Object.html#hashCode%28%29), [HashMap](../../../java.base/java/util/HashMap.html "class in java.util")
* #### hashCode
public int hashCode()
Computes the hash code of this reference. The hash code is the sum of the hash code of its addresses.
Overrides:
`[hashCode](../../../java.base/java/lang/Object.html#hashCode%28%29)` in class `[Object](../../../java.base/java/lang/Object.html "class in java.lang")`
Returns:
A hash code of this reference as an int.
See Also:
[Object.equals(java.lang.Object)](../../../java.base/java/lang/Object.html#equals%28java.lang.Object%29), [System.identityHashCode(java.lang.Object)](../../../java.base/java/lang/System.html#identityHashCode%28java.lang.Object%29)
* #### toString
public [String](../../../java.base/java/lang/String.html "class in java.lang") toString()
Generates the string representation of this reference. The string consists of the class name to which this reference refers, and the string representation of each of its addresses. This representation is intended for display only and not to be parsed.
Overrides:
`[toString](../../../java.base/java/lang/Object.html#toString%28%29)` in class `[Object](../../../java.base/java/lang/Object.html "class in java.lang")`
Returns:
The non-null string representation of this reference.
* #### clone
public [Object](../../../java.base/java/lang/Object.html "class in java.lang") clone()
Makes a copy of this reference using its class name list of addresses, class factory name and class factory location. Changes to the newly created copy does not affect this Reference and vice versa.
Overrides:
`[clone](../../../java.base/java/lang/Object.html#clone%28%29)` in class `[Object](../../../java.base/java/lang/Object.html "class in java.lang")`
Returns:
a clone of this instance.
See Also:
[Cloneable](../../../java.base/java/lang/Cloneable.html "interface in java.lang")