Fix JavaDocs for factory
git-svn-id: https://svn.apache.org/repos/asf/turbine/fulcrum/trunk/factory@1844842 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/java/org/apache/fulcrum/factory/DefaultFactoryService.java b/src/java/org/apache/fulcrum/factory/DefaultFactoryService.java
index 8d4a361..15df0f5 100644
--- a/src/java/org/apache/fulcrum/factory/DefaultFactoryService.java
+++ b/src/java/org/apache/fulcrum/factory/DefaultFactoryService.java
@@ -39,33 +39,37 @@
* The Factory Service instantiates objects using specified
* class loaders. If none is specified, the default one
* will be used.
+ *
+ * avalon.component name="factory" lifestyle="singleton"
+ * avalon.service type="org.apache.fulcrum.factory.FactoryService"
*
* @author <a href="mailto:epugh@upstate.com">Eric Pugh</a>
* @author <a href="mailto:ilkka.priha@simsoft.fi">Ilkka Priha</a>
* @author <a href="mailto:mcconnell@apache.org">Stephen McConnell</a>
* @version $Id$
*
- * @avalon.component name="factory" lifestyle="singleton"
- * @avalon.service type="org.apache.fulcrum.factory.FactoryService"
*/
public class DefaultFactoryService
extends AbstractLogEnabled
implements FactoryService, Configurable, Initializable, Disposable
{
protected boolean initialized = false;
- //private boolean disposed = false;
+
/**
* The property specifying a set of additional class loaders.
*/
private static final String CLASS_LOADER = "classloader";
+
/**
* The property prefix specifying additional object factories.
*/
private static final String OBJECT_FACTORY = "object-factory";
+
/**
* The name of the default factory.
*/
protected static final String DEFAULT_FACTORY = "default";
+
/**
* Primitive classes for reflection of constructors.
*/
@@ -380,7 +384,9 @@
* Switches an object into the context of a different class loader.
*
* @param object an object to switch.
+ * @param loader the ClassLoader to use
* @param loader the loader of the new context.
+ * @return the object
*/
protected Object switchObjectContext(Object object, ClassLoader loader)
{
@@ -428,7 +434,7 @@
* Loads the named class using the default class loader.
*
* @param className the name of the class to load.
- * @return the loaded class.
+ * @return {@inheritDoc} the loaded class.
* @throws ClassNotFoundException if the class was not found.
*/
@SuppressWarnings("unchecked")
@@ -473,7 +479,7 @@
*
* @param className the name of the class to load.
* @param loader the loader to use.
- * @return the loaded class.
+ * @return {@inheritDoc} the loaded class.
* @throws ClassNotFoundException if the class was not found.
*/
@SuppressWarnings("unchecked")
@@ -494,7 +500,7 @@
* factory.
*
* @param className the name of the class to load.
- * @return the factory, or null if not specified and no default.
+ * @return {@inheritDoc} the factory, or null if not specified and no default.
* @throws FactoryException if instantiation of the factory fails.
*/
@SuppressWarnings("unchecked")
@@ -576,7 +582,7 @@
* Initializes the service by loading default class loaders
* and customized object factories.
*
- * @throws InitializationException if initialization fails.
+ * @throws Exception if initialization fails.
*/
@Override
public void initialize() throws Exception
diff --git a/src/java/org/apache/fulcrum/factory/FactoryException.java b/src/java/org/apache/fulcrum/factory/FactoryException.java
index 7865d90..ed234ae 100644
--- a/src/java/org/apache/fulcrum/factory/FactoryException.java
+++ b/src/java/org/apache/fulcrum/factory/FactoryException.java
@@ -19,6 +19,8 @@
* under the License.
*/
+import java.lang.Exception;
+
/**
* Exception thrown when there is a problem with the FactoryService
*
@@ -41,7 +43,9 @@
}
/**
- * @see java.lang.Exception(String, Throwable)
+ * {@link java.lang.Exception#Exception(String, Throwable)}
+ * @param message the message
+ * @param e the exception
*/
public FactoryException(String message, Throwable e)
{
@@ -49,7 +53,8 @@
}
/**
- * @see java.lang.Exception(Throwable)
+ * {@link java.lang.Exception#Exception(Throwable)}
+ * @param e the exception to bubble up
*/
public FactoryException(Throwable e)
{
@@ -57,7 +62,8 @@
}
/**
- * @see java.lang.Exception(String)
+ * {@link java.lang.Exception#Exception(String)}
+ * @param msg the message to bubble up
*/
public FactoryException(String msg)
{
diff --git a/src/java/org/apache/fulcrum/factory/FactoryService.java b/src/java/org/apache/fulcrum/factory/FactoryService.java
index a289bf3..f48ecd4 100644
--- a/src/java/org/apache/fulcrum/factory/FactoryService.java
+++ b/src/java/org/apache/fulcrum/factory/FactoryService.java
@@ -41,7 +41,7 @@
* Gets an instance of a class.
*
* @param clazz the name of the class.
- * @return the instance.
+ * @return {@inheritDoc} the instance.
* @throws FactoryException if instantiation fails.
*/
<T> T getInstance(Class<T> clazz)
@@ -51,7 +51,7 @@
* Gets an instance of a named class.
*
* @param className the name of the class.
- * @return the instance.
+ * @return {@inheritDoc} the instance.
* @throws FactoryException if instantiation fails.
*/
<T> T getInstance(String className)
@@ -65,7 +65,7 @@
*
* @param className the name of the class.
* @param loader the class loader.
- * @return the instance.
+ * @return {@inheritDoc} the instance.
* @throws FactoryException if instantiation fails.
*/
<T> T getInstance(String className,
@@ -80,7 +80,7 @@
* @param className the name of the class.
* @param params an array containing the parameters of the constructor.
* @param signature an array containing the signature of the constructor.
- * @return the instance.
+ * @return {@inheritDoc} the instance.
* @throws FactoryException if instantiation fails.
*/
<T> T getInstance(String className,
@@ -100,7 +100,7 @@
* @param loader the class loader.
* @param params an array containing the parameters of the constructor.
* @param signature an array containing the signature of the constructor.
- * @return the instance.
+ * @return {@inheritDoc} the instance.
* @throws FactoryException if instantiation fails.
*/
<T> T getInstance(String className,
@@ -125,7 +125,7 @@
* @param clazz the class.
* @param params an array containing the parameters of the method.
* @param signature an array containing the signature of the method.
- * @return an array of signature classes. Note that in some cases
+ * @return {@inheritDoc} an array of signature classes. Note that in some cases
* objects in the parameter array can be switched to the context
* of a different class loader.
* @throws ClassNotFoundException if any of the classes is not found.
diff --git a/src/java/org/apache/fulcrum/factory/utils/ObjectInputStreamForContext.java b/src/java/org/apache/fulcrum/factory/utils/ObjectInputStreamForContext.java
index 21eae4a..bf9338b 100644
--- a/src/java/org/apache/fulcrum/factory/utils/ObjectInputStreamForContext.java
+++ b/src/java/org/apache/fulcrum/factory/utils/ObjectInputStreamForContext.java
@@ -1,7 +1,5 @@
package org.apache.fulcrum.factory.utils;
-import java.io.IOException;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -22,6 +20,7 @@
*/
import java.io.InputStream;
+import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectStreamClass;
@@ -38,7 +37,11 @@
*/
private ClassLoader classLoader;
- // this is to make the proxy happy.
+ /**
+ * this is to make the proxy happy.
+ *
+ * @throws IOException Generic exception
+ */
public ObjectInputStreamForContext()
throws IOException
{
@@ -60,9 +63,13 @@
}
/**
- * @see java.io.ObjectInputStream#resolveClass(ObjectStreamClass)
+ * {@link java.io.ObjectInputStream#resolveClass(ObjectStreamClass)}
+ *
+ * @param v ObjectStreamClass to resolve
+ * @return {@inheritDoc} class to resolve
+ * @throws IOException if object stream not found
+ * @throws ClassNotFoundException if class not found
*/
- @Override
protected Class<?> resolveClass(ObjectStreamClass v)
throws IOException,
ClassNotFoundException
diff --git a/src/test/org/apache/fulcrum/factory/FactoryServiceTest.java b/src/test/org/apache/fulcrum/factory/FactoryServiceTest.java
index 0f0fe9e..e86a229 100644
--- a/src/test/org/apache/fulcrum/factory/FactoryServiceTest.java
+++ b/src/test/org/apache/fulcrum/factory/FactoryServiceTest.java
@@ -28,8 +28,6 @@
* @author Eric Pugh
* @author <a href="mailto:mcconnell@apache.org">Stephen McConnell</a>
*
- * To change the template for this generated type comment go to
- * Window>Preferences>Java>Code Generation>Code and Comments
*/
public class FactoryServiceTest extends BaseUnitTest
{
@@ -102,15 +100,18 @@
assertEquals(sourceValu, object.toString());
}
+
/**
- * @todo Need to run a test where the loader is NOT supported.
- * @throws Exception
+ * Test if the loader is supported
+ *
+ * @throws Exception Generic exception
*/
public void testIsLoaderSupported() throws Exception
{
+ // TODO Need to run a test where the loader is NOT supported.
assertTrue(factoryService.isLoaderSupported("java.lang.String"));
-
}
+
public void testGetSignature() throws Exception
{
Object params[] = new Object[1];
diff --git a/src/test/org/apache/fulcrum/factory/utils/ObjectInputStreamForContextTest.java b/src/test/org/apache/fulcrum/factory/utils/ObjectInputStreamForContextTest.java
index f00fa7e..d8010a1 100644
--- a/src/test/org/apache/fulcrum/factory/utils/ObjectInputStreamForContextTest.java
+++ b/src/test/org/apache/fulcrum/factory/utils/ObjectInputStreamForContextTest.java
@@ -26,11 +26,7 @@
/**
* @author Eric Pugh
- *
- * To change the template for this generated type comment go to
- * Window>Preferences>Java>Code Generation>Code and Comments
*/
-
public class ObjectInputStreamForContextTest extends TestCase
{
public static void main(String[] args)