You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by jc...@apache.org on 2008/02/21 19:50:52 UTC

svn commit: r629930 - /commons/proper/proxy/branches/proxy-1.0-work/src/main/java/org/apache/commons/proxy/factory/javassist/JavassistUtils.java

Author: jcarman
Date: Thu Feb 21 10:50:52 2008
New Revision: 629930

URL: http://svn.apache.org/viewvc?rev=629930&view=rev
Log:
Added javadocs

Modified:
    commons/proper/proxy/branches/proxy-1.0-work/src/main/java/org/apache/commons/proxy/factory/javassist/JavassistUtils.java

Modified: commons/proper/proxy/branches/proxy-1.0-work/src/main/java/org/apache/commons/proxy/factory/javassist/JavassistUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/proxy/branches/proxy-1.0-work/src/main/java/org/apache/commons/proxy/factory/javassist/JavassistUtils.java?rev=629930&r1=629929&r2=629930&view=diff
==============================================================================
--- commons/proper/proxy/branches/proxy-1.0-work/src/main/java/org/apache/commons/proxy/factory/javassist/JavassistUtils.java (original)
+++ commons/proper/proxy/branches/proxy-1.0-work/src/main/java/org/apache/commons/proxy/factory/javassist/JavassistUtils.java Thu Feb 21 10:50:52 2008
@@ -30,6 +30,8 @@
 import java.util.Set;
 
 /**
+ * Some utility methods for dealing with Javassist.
+ * 
  * @author James Carman
  * @since 1.0
  */
@@ -52,12 +54,26 @@
 // Static Methods
 //----------------------------------------------------------------------------------------------------------------------
 
+    /**
+     * Adds a field to a class.
+     * 
+     * @param fieldType the field's type
+     * @param fieldName the field name
+     * @param enclosingClass the class receiving the new field 
+     * @throws CannotCompileException if a compilation problem occurs
+     */
     public static void addField( Class fieldType, String fieldName, CtClass enclosingClass )
             throws CannotCompileException
     {
         enclosingClass.addField( new CtField( resolve( fieldType ), fieldName, enclosingClass ) );
     }
 
+    /**
+     * Finds the {@link CtClass} corresponding to the Java {@link Class} passed in.
+     * 
+     * @param clazz the Java {@link Class}
+     * @return the {@link CtClass}
+     */
     public static CtClass resolve( Class clazz )
     {
         synchronized( classLoaders )
@@ -80,6 +96,12 @@
         }
     }
 
+    /**
+     * Adds interfaces to a {@link CtClass}
+     * 
+     * @param ctClass the {@link CtClass}
+     * @param proxyClasses the interfaces
+     */
     public static void addInterfaces( CtClass ctClass, Class[] proxyClasses )
     {
         for( int i = 0; i < proxyClasses.length; i++ )
@@ -89,16 +111,35 @@
         }
     }
 
+    /**
+     * Creates a new {@link CtClass} derived from the Java {@link Class} using the default base name.
+     * 
+     * @param superclass the superclass
+     * @return the new derived {@link CtClass}
+     */
     public static CtClass createClass( Class superclass )
     {
         return createClass( DEFAULT_BASE_NAME, superclass );
     }
 
+    /**
+     * Creates a new {@link CtClass} derived from the Java {@link Class} using the supplied base name.
+     * 
+     * @param baseName the base name
+     * @param superclass the superclass
+     * @return the new derived {@link CtClass}
+     */
     public synchronized static CtClass createClass( String baseName, Class superclass )
     {
         return classPool.makeClass( baseName + "_" + classNumber++, resolve( superclass ) );
     }
 
+    /**
+     * Resolves an array of Java {@link Class}es to an array of their corresponding {@link CtClass}es.
+     * 
+     * @param classes the Java {@link Class}es
+     * @return the corresponding {@link CtClass}es
+     */
     public static CtClass[] resolve( Class[] classes )
     {
         final CtClass[] ctClasses = new CtClass[classes.length];