aboutsummaryrefslogtreecommitdiff
path: root/libjava/classpath/javax/naming/Reference.java
diff options
context:
space:
mode:
authorMark Wielaard <mark@gcc.gnu.org>2006-08-14 23:12:35 +0000
committerMark Wielaard <mark@gcc.gnu.org>2006-08-14 23:12:35 +0000
commitac1ed908de999523efc36f38e69bca1aadfe0808 (patch)
tree97037d2c09c8384d80531f67ec36a01205df6bdb /libjava/classpath/javax/naming/Reference.java
parentabab460491408e05ea93fb85e1975296a87df504 (diff)
downloadgcc-ac1ed908de999523efc36f38e69bca1aadfe0808.zip
gcc-ac1ed908de999523efc36f38e69bca1aadfe0808.tar.gz
gcc-ac1ed908de999523efc36f38e69bca1aadfe0808.tar.bz2
Imported GNU Classpath 0.92
2006-08-14 Mark Wielaard <mark@klomp.org> Imported GNU Classpath 0.92 * HACKING: Add more importing hints. Update automake version requirement. * configure.ac (gconf-peer): New enable AC argument. Add --disable-gconf-peer and --enable-default-preferences-peer to classpath configure when gconf is disabled. * scripts/makemake.tcl: Set gnu/java/util/prefs/gconf and gnu/java/awt/dnd/peer/gtk to bc. Classify gnu/java/security/Configuration.java as generated source file. * gnu/java/lang/management/VMGarbageCollectorMXBeanImpl.java, gnu/java/lang/management/VMMemoryPoolMXBeanImpl.java, gnu/java/lang/management/VMClassLoadingMXBeanImpl.java, gnu/java/lang/management/VMRuntimeMXBeanImpl.java, gnu/java/lang/management/VMMemoryManagerMXBeanImpl.java, gnu/java/lang/management/VMThreadMXBeanImpl.java, gnu/java/lang/management/VMMemoryMXBeanImpl.java, gnu/java/lang/management/VMCompilationMXBeanImpl.java: New VM stub classes. * java/lang/management/VMManagementFactory.java: Likewise. * java/net/VMURLConnection.java: Likewise. * gnu/java/nio/VMChannel.java: Likewise. * java/lang/Thread.java (getState): Add stub implementation. * java/lang/Class.java (isEnum): Likewise. * java/lang/Class.h (isEnum): Likewise. * gnu/awt/xlib/XToolkit.java (getClasspathTextLayoutPeer): Removed. * javax/naming/spi/NamingManager.java: New override for StackWalker functionality. * configure, sources.am, Makefile.in, gcj/Makefile.in, include/Makefile.in, testsuite/Makefile.in: Regenerated. From-SVN: r116139
Diffstat (limited to 'libjava/classpath/javax/naming/Reference.java')
-rw-r--r--libjava/classpath/javax/naming/Reference.java158
1 files changed, 134 insertions, 24 deletions
diff --git a/libjava/classpath/javax/naming/Reference.java b/libjava/classpath/javax/naming/Reference.java
index 5b9883a..0fdecc1 100644
--- a/libjava/classpath/javax/naming/Reference.java
+++ b/libjava/classpath/javax/naming/Reference.java
@@ -43,54 +43,118 @@ import java.util.Enumeration;
import java.util.Vector;
/**
+ * This class represents a reference to an object that is located outside of the
+ * naming/directory system.
+ *
+ * @see Referenceable
+ *
* @author Tom Tromey (tromey@redhat.com)
- * @date May 16, 2001
*/
public class Reference implements Cloneable, Serializable
{
private static final long serialVersionUID = - 1673475790065791735L;
-
+
+ /**
+ * The list of addresses, stored in this reference. The object may be
+ * have by several different addresses.
+ */
+ protected Vector addrs;
+
+ /**
+ * The name of the class factory to create an instance of the object,
+ * referenced by this reference.
+ */
+ protected String classFactory;
+
+ /**
+ * The location, from where the class factory should be loaded.
+ */
+ protected String classFactoryLocation;
+
+ /**
+ * The name of the class of the object, to that this reference refers.
+ */
+ protected String className;
+
+ /**
+ * Create a new reference that is referencting to the object of the
+ * specified class.
+ */
public Reference (String className)
{
this.className = className;
addrs = new Vector ();
}
-
+
+ /**
+ * Create a new reference that is referencing to the object of the
+ * specified class with the given address.
+ */
public Reference (String className, RefAddr addr)
{
this.className = className;
addrs = new Vector ();
addrs.add (addr);
}
-
- public Reference (String className, String factory, 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.
+ *
+ * @param className the object class name
+ * @param factoryClassName the object factory class name
+ * @param factoryLocation the object factory location
+ */
+ public Reference (String className, String factoryClassName,
+ String factoryLocation)
{
this.className = className;
- this.classFactory = factory;
+ this.classFactory = factoryClassName;
this.classFactoryLocation = factoryLocation;
addrs = new Vector ();
}
+ /**
+ * 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.
+ *
+ * @param className the object class name
+ * @param addr the address of the object
+ * @param factoryClassName the object factory class name
+ * @param factoryLocation the object factory location
+ */
public Reference (String className, RefAddr addr,
- String factory, String factoryLocation)
+ String factoryClassName, String factoryLocation)
{
this.className = className;
- this.classFactory = factory;
+ this.classFactory = factoryClassName;
this.classFactoryLocation = factoryLocation;
addrs = new Vector ();
addrs.add (addr);
}
+ /**
+ * Add the new address for this object at the given position of the
+ * address list.
+ */
public void add (int posn, RefAddr addr)
{
addrs.add (posn, addr);
}
-
+
+ /**
+ * Appends the new object address to the end of the address list.
+ */
public void add (RefAddr addr)
{
addrs.add (addr);
}
-
+
+ /**
+ * Removes all defined addresses of the object.
+ */
public void clear ()
{
addrs.clear ();
@@ -109,7 +173,10 @@ public class Reference implements Cloneable, Serializable
{
return (a == null) ? (b == null) : a.equals (b);
}
-
+
+ /**
+ * Compares two addresses for equality, by value.
+ */
public boolean equals (Object obj)
{
if (! (obj instanceof Reference))
@@ -120,12 +187,23 @@ public class Reference implements Cloneable, Serializable
&& equals (className, r.className)
&& addrs.equals (r.addrs));
}
-
+
+ /**
+ * Get the address of this object at the given position.
+ */
public RefAddr get (int posn)
{
return (RefAddr) addrs.get (posn);
}
-
+
+ /**
+ * Get the given type of address for this object.
+ *
+ * @param addrType the needed type of address
+ *
+ * @return the address of this object, having the specified type. If there
+ * is no address of such type, null is returned.
+ */
public RefAddr get (String addrType)
{
for (int i = 0; i < addrs.size (); ++i)
@@ -136,27 +214,50 @@ public class Reference implements Cloneable, Serializable
}
return null;
}
-
+
+ /**
+ * Get the enumeration over all defined addresses of the object.
+ */
public Enumeration getAll ()
{
return addrs.elements ();
}
-
+
+ /**
+ * Get the name of the class of the referenced object.
+ *
+ * @see #className
+ */
public String getClassName ()
{
return className;
}
-
+
+ /**
+ * Get the location of the factory class of the referenced object.
+ *
+ * @see #classFactoryLocation
+ */
public String getFactoryClassLocation ()
{
return classFactoryLocation;
}
+ /**
+ * Get the name of the factory class of the referenced object
+ *
+ * @see #classFactory
+ */
public String getFactoryClassName ()
{
return classFactory;
}
-
+
+ /**
+ * Get the hashcode of this reference.
+ *
+ * @return the sum of the hash codes of the addresses.
+ */
public int hashCode ()
{
// The spec says the hash code is the sum of the hash codes of the
@@ -166,17 +267,30 @@ public class Reference implements Cloneable, Serializable
h += addrs.get (i).hashCode ();
return h;
}
-
+
+ /**
+ * Remove the address at the given position.
+ *
+ * @param posn the position of the address to remove
+ *
+ * @return the removed address
+ */
public Object remove (int posn)
{
return addrs.remove (posn);
}
-
+
+ /**
+ * Return the number of the defined addresses.
+ */
public int size ()
{
return addrs.size ();
}
-
+
+ /**
+ * Return the string representation.
+ */
public String toString ()
{
String x = getClass ().toString () + "[";
@@ -189,8 +303,4 @@ public class Reference implements Cloneable, Serializable
return x + "]";
}
- protected Vector addrs;
- protected String classFactory;
- protected String classFactoryLocation;
- protected String className;
}