commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bay...@apache.org
Subject cvs commit: jakarta-commons/lang/src/java/org/apache/commons/lang/reflect ConstructorUtils.java FieldUtils.java MethodUtils.java ReflectionException.java
Date Mon, 14 Jul 2003 22:29:04 GMT
bayard      2003/07/14 15:29:04

  Modified:    lang/src/java/org/apache/commons/lang/reflect
                        ConstructorUtils.java FieldUtils.java
                        MethodUtils.java ReflectionException.java
  Log:
  Solely Javadoc fixes.
  
  Revision  Changes    Path
  1.2       +127 -87   jakarta-commons/lang/src/java/org/apache/commons/lang/reflect/ConstructorUtils.java
  
  Index: ConstructorUtils.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/lang/src/java/org/apache/commons/lang/reflect/ConstructorUtils.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ConstructorUtils.java	24 Oct 2002 23:12:54 -0000	1.1
  +++ ConstructorUtils.java	14 Jul 2003 22:29:03 -0000	1.2
  @@ -58,27 +58,30 @@
   
   import org.apache.commons.lang.ArrayUtils;
   /**
  - * <code>ConstructorUtils</code> contains utility methods for working for
  - * constructors by reflection.
  - * <p>
  - * The ability is provided to break the scoping restrictions coded by the
  + * <p><code>ConstructorUtils</code> contains utility methods for working for
  + * constructors by reflection.</p>
  + *
  + * <p>The ability is provided to break the scoping restrictions coded by the
    * programmer. This can allow classes to be created that shouldn't be, for
    * example new instances of an enumerated type. Thus, this facility should
  - * be used with care.
  + * be used with care.</p>
    *
    * @author <a href="mailto:scolebourne@apache.org">Stephen Colebourne</a>
    * @version $Id$
    */
   public class ConstructorUtils {
   
  -    /** An empty constructor array */
  +    /**
  +     * An empty constructor array.
  +     */
       public static final Constructor[] EMPTY_CONSTRUCTOR_ARRAY = new Constructor[0];
       
       /**
  -     * ConstructorUtils instances should NOT be constructed in standard programming.
  -     * Instead, the class should be used as <code>ConstructorUtils.newInstance(...)</code>.
  +     * <p>ConstructorUtils instances should NOT be constructed in standard programming.</p>
  +     *
  +     * <p>Instead, the class should be used as <code>ConstructorUtils.newInstance(...)</code>.
        * This constructor is public to permit tools that require a JavaBean instance
  -     * to operate.
  +     * to operate.</p>
        */
       public ConstructorUtils() {
       }
  @@ -86,30 +89,35 @@
       // -------------------------------------------------------------------------
       
       /**
  -     * Gets a public <code>Constructor</code> object by matching the 
  -     * parameter types as per the Java Language Specification.
  +     * <p>Gets a public <code>Constructor</code> object by matching the
  +     * parameter types as per the Java Language Specification.</p>
        *
  -     * @param cls  Class object to find constructor for, must not be null
  -     * @param types  array of Class objects representing parameter types, may be null
  +     * @param cls  Class object to find constructor for, must not
  +     *  be <code>null</code>
  +     * @param types  array of Class objects representing parameter
  +     *  types, may be <code>null</code>
        * @return Constructor object
        * @throws ReflectionException if an error occurs during reflection
  -     * @throws IllegalArgumentException if the class is null
  +     * @throws IllegalArgumentException if the class is <code>null</code>
        */
       public static Constructor getConstructor(Class cls, Class[] types) {
           return getConstructor(cls, types, false);
       }
       
       /**
  -     * Gets a public <code>Constructor</code> object by matching the 
  -     * parameter types as per the Java Language Specification.
  +     * <p>Gets a public <code>Constructor</code> object by matching the
  +     * parameter types as per the Java Language Specification.</p>
        *
  -     * @param cls  Class object to find constructor for, must not be null
  -     * @param types  array of Class objects representing parameter types, may be null
  -     * @param breakScope  whether to break scope restrictions using the
  -     *  <code>setAccessible</code> method. False will only match public methods.
  +     * @param cls  Class object to find constructor for, must not
  +     *  be <code>null</code>
  +     * @param types  array of Class objects representing parameter
  +     *  types, may be <code>null</code>
  +     * @param breakScope  whether to break scope restrictions using
  +     *  the <code>setAccessible</code> method. <code>False</code> will
  +     *  only match public methods.
        * @return Constructor object
        * @throws ReflectionException if an error occurs during reflection
  -     * @throws IllegalArgumentException if the class is null
  +     * @throws IllegalArgumentException if the class is <code>null</code>
        */
       public static Constructor getConstructor(Class cls, Class[] types, boolean breakScope) {
           if (cls == null) {
  @@ -151,30 +159,34 @@
       // -------------------------------------------------------------------------
       
       /**
  -     * Gets a public <code>Constructor</code> object by exactly matching the
  -     * parameter types.
  +     * <p>Gets a public <code>Constructor</code> object by exactly matching the
  +     * parameter types.</p>
        *
  -     * @param cls  Class object to find constructor for, must not be null
  -     * @param types  array of Class objects representing parameter types, may be null
  +     * @param cls  Class object to find constructor for, must not
  +     *  be <code>null</code>
  +     * @param types  array of Class objects representing parameter
  +     *  types, may be <code>null</code>
        * @return Constructor object
        * @throws ReflectionException if an error occurs during reflection
  -     * @throws IllegalArgumentException if the class is null
  +     * @throws IllegalArgumentException if the class is <code>null</code>
        */
       public static Constructor getConstructorExact(Class cls, Class[] types) {
           return getConstructorExact(cls, types, false);
       }
       
       /**
  -     * Gets a <code>Constructor</code> object by exactly matching the
  -     * parameter types.
  +     * <p>Gets a <code>Constructor</code> object by exactly matching the
  +     * parameter types.</p>
        *
  -     * @param cls  Class object to find constructor for, must not be null
  -     * @param types  array of Class objects representing parameter types, may be null
  +     * @param cls  Class object to find constructor for, must not
  +     *  be <code>null</code>
  +     * @param types  array of Class objects representing parameter types, may
  +     *  be <code>null</code>
        * @param breakScope  whether to break scope restrictions using the
        *  <code>setAccessible</code> method. False will only match public methods.
        * @return Constructor object
        * @throws ReflectionException if an error occurs during reflection
  -     * @throws IllegalArgumentException if the class is null
  +     * @throws IllegalArgumentException if the class is <code>null</code>
        */
       public static Constructor getConstructorExact(Class cls, Class[] types, boolean breakScope) {
           if (cls == null) {
  @@ -206,41 +218,48 @@
       // -------------------------------------------------------------------------
       
       /**
  -     * Creates a new instance using a <code>Constructor</code> and parameters.
  +     * <p>Creates a new instance using a <code>Constructor</code> and parameters.</p>
        * 
  -     * @param con  Class object to find constructor for, must not be null
  -     * @param param  the single parameter to pass to the constructor, may be null
  +     * @param con  Class object to find constructor for, must not
  +     *  be <code>null</code>
  +     * @param param  the single parameter to pass to the constructor, may
  +     *  be <code>null</code>
        * @return the newly created object
        * @throws ReflectionException if an error occurs during reflection
  -     * @throws IllegalArgumentException if the constructor is null
  +     * @throws IllegalArgumentException if the constructor is <code>null</code>
        */
       public static Object newInstance(Constructor con, Object param) {
           return newInstance(con, new Object[] {param}, false);
       }
       
       /**
  -     * Creates a new instance using a <code>Constructor</code> and parameters.
  +     * <p>Creates a new instance using a <code>Constructor</code> and parameters.</p>
        * 
  -     * @param con  Class object to find constructor for, must not be null
  -     * @param params  array of objects to pass as parameters, may be null
  +     * @param con  Class object to find constructor for, must not
  +     *  be <code>null</code>
  +     * @param params  array of objects to pass as parameters, may
  +     *  be <code>null</code>
        * @return the newly created object
        * @throws ReflectionException if an error occurs during reflection
  -     * @throws IllegalArgumentException if the constructor is null
  +     * @throws IllegalArgumentException if the constructor is <code>null</code>
        */
       public static Object newInstance(Constructor con, Object[] params) {
           return newInstance(con, params, false);
       }
       
       /**
  -     * Creates a new instance using a <code>Constructor</code> and parameters.
  +     * <p>Creates a new instance using a <code>Constructor</code> and parameters.</p>
        * 
  -     * @param con  Class object to find constructor for, must not be null
  -     * @param params  array of objects to pass as parameters, may be null
  +     * @param con  Class object to find constructor for, must not
  +     *  be <code>null</code>
  +     * @param params  array of objects to pass as parameters, may
  +     *  be <code>null</code>
        * @param breakScope  whether to break scope restrictions using the
  -     *  <code>setAccessible</code> method. False will only match public methods.
  +     *  <code>setAccessible</code> method. <code>False</code> will only
  +     *  match public methods.
        * @return the newly created object
        * @throws ReflectionException if an error occurs during reflection
  -     * @throws IllegalArgumentException if the constructor is null
  +     * @throws IllegalArgumentException if the constructor is <code>null</code>
        */
       public static Object newInstance(Constructor con, Object[] params, boolean breakScope) {
           if (con == null) {
  @@ -266,7 +285,7 @@
       // -------------------------------------------------------------------------
       
       /**
  -     * Creates a new instance of the specified <code>Class</code> by name.
  +     * <p>Creates a new instance of the specified <code>Class</code> by name.</p>
        * 
        * @param className  String class name to instantiate, must not be empty
        * @return the newly created object
  @@ -278,9 +297,10 @@
       }
       
       /**
  -     * Creates a new instance of the specified <code>Class</code> by name.
  -     * If the constructor is not public, <code>setAccessible(true)</code>
  -     * is used to make it accessible.
  +     * <p>Creates a new instance of the specified <code>Class</code> by name.</p>
  +     *
  +     * <p>If the constructor is not public, <code>setAccessible(true)</code>
  +     * is used to make it accessible.</p>
        * 
        * @param className  String class name to instantiate, must not be empty
        * @param breakScope  whether to break scope restrictions using the
  @@ -297,28 +317,30 @@
       // -------------------------------------------------------------------------
       
       /**
  -     * Creates a new instance of the specified <code>Class</code>.
  +     * <p>Creates a new instance of the specified <code>Class</code>.</p>
        * 
  -     * @param cls  Class object to instantiate, must not be null
  +     * @param cls  Class object to instantiate, must not be <code>null</code>
        * @return the newly created object
        * @throws ReflectionException if an error occurs during reflection
  -     * @throws IllegalArgumentException if the class is null
  +     * @throws IllegalArgumentException if the class is <code>null</code>
        */
       public static Object newInstance(Class cls) {
           return newInstance(cls, false);
       }
       
       /**
  -     * Creates a new instance of the specified <code>Class</code>.
  -     * If the constructor is not public, <code>setAccessible(true)</code>
  -     * is used to make it accessible.
  +     * <p>Creates a new instance of the specified <code>Class</code>.</p>
  +     *
  +     * <p>If the constructor is not public, <code>setAccessible(true)</code>
  +     * is used to make it accessible.</p>
        * 
  -     * @param cls  Class object to instantiate, must not be null
  +     * @param cls  Class object to instantiate, must not be <code>null</code>
        * @param breakScope  whether to break scope restrictions using the
  -     *  <code>setAccessible</code> method. False will only match public methods.
  +     *  <code>setAccessible</code> method. <code>False</code> will only
  +     *  match public methods.
        * @return the newly created object
        * @throws ReflectionException if an error occurs during reflection
  -     * @throws IllegalArgumentException if the class is null
  +     * @throws IllegalArgumentException if the class is <code>null</code>
        */
       public static Object newInstance(Class cls, boolean breakScope) {
           if (breakScope) {
  @@ -346,35 +368,44 @@
       // -------------------------------------------------------------------------
       
       /**
  -     * Creates a new instance of the specified <code>Class</code>.
  -     * The constructor is found by matching the 
  -     * parameter types as per the Java Language Specification.
  +     * <p>Creates a new instance of the specified <code>Class</code>.</p>
  +     *
  +     * <p>The constructor is found by matching the
  +     * parameter types as per the Java Language Specification.</p>
        * 
  -     * @param cls  Class object to instantiate, must not be null
  -     * @param types  array of Class objects representing parameter types, may be null
  -     * @param params  array of objects to pass as parameters, may be null
  +     * @param cls  Class object to instantiate, must not
  +     *  be <code>null</code>
  +     * @param types  array of Class objects representing parameter types,
  +     *  may be <code>null</code>
  +     * @param params  array of objects to pass as parameters, may
  +     *  be <code>null</code>
        * @return the newly created object
        * @throws ReflectionException if an error occurs during reflection
  -     * @throws IllegalArgumentException if the class is null
  +     * @throws IllegalArgumentException if the class is <code>null</code>
        */
       public static Object newInstance(Class cls, Class[] types, Object[] params) {
           return newInstance(cls, types, params, false);
       }
       
       /**
  -     * Creates a new instance of the specified <code>Class</code>.
  -     * The constructor is found by matching the 
  -     * parameter types as per the Java Language Specification.
  -     * 
  -     * @param cls  Class object to instantiate, must not be null
  -     * @param types  array of Class objects representing parameter types, may be null
  -     * @param params  array of objects to pass as parameters, may be null
  +     * <p>Creates a new instance of the specified <code>Class</code>.</p>
  +     *
  +     * <p>The constructor is found by matching the
  +     * parameter types as per the Java Language Specification.</p>
  +     * 
  +     * @param cls  Class object to instantiate, must not
  +     *  be <code>null</code>
  +     * @param types  array of Class objects representing parameter types,
  +     *  may be <code>null</code>
  +     * @param params  array of objects to pass as parameters, may
  +     *  be <code>null</code>
        * @param breakScope  whether to break scope restrictions using the
  -     *  <code>setAccessible</code> method. False will only match public methods.
  +     *  <code>setAccessible</code> method. <code>False</code> will only
  +     *  match public methods.
        * @return the newly created object
        * @throws ReflectionException if an error occurs during reflection
        * @throws IllegalArgumentException if the types and params lengths differ
  -     * @throws IllegalArgumentException if the class is null
  +     * @throws IllegalArgumentException if the class is <code>null</code>
        */
       public static Object newInstance(Class cls, Class[] types, Object[] params, boolean breakScope) {
           if (ArrayUtils.isSameLength(types, params) == false) {
  @@ -387,33 +418,42 @@
       // -------------------------------------------------------------------------
       
       /**
  -     * Creates a new instance of the specified <code>Class</code>.
  -     * The constructor is found by matching the parameter types exactly.
  +     * <p>Creates a new instance of the specified <code>Class</code>.</p>
  +     *
  +     * <p>The constructor is found by matching the parameter types exactly.</p>
        * 
  -     * @param cls  Class object to instantiate, must not be null
  -     * @param types  array of Class objects representing parameter types, may be null
  -     * @param params  array of objects to pass as parameters, may be null
  +     * @param cls  Class object to instantiate, must not
  +     *  be <code>null</code>
  +     * @param types  array of Class objects representing parameter types,
  +     *  may be <code>null</code>
  +     * @param params  array of objects to pass as parameters, may
  +     *  be <code>null</code>
        * @return the newly created object
        * @throws ReflectionException if an error occurs during reflection
  -     * @throws IllegalArgumentException if the class is null
  +     * @throws IllegalArgumentException if the class is <code>null</code>
        */
       public static Object newInstanceExact(Class cls, Class[] types, Object[] params) {
           return newInstanceExact(cls, types, params, false);
       }
       
       /**
  -     * Creates a new instance of the specified <code>Class</code>.
  -     * The constructor is found by matching the parameter types exactly.
  +     * <p>Creates a new instance of the specified <code>Class</code>.</p>
  +     *
  +     * <p>The constructor is found by matching the parameter types exactly.</p>
        * 
  -     * @param cls  Class object to instantiate, must not be null
  -     * @param types  array of Class objects representing parameter types, may be null
  -     * @param params  array of objects to pass as parameters, may be null
  +     * @param cls  Class object to instantiate, must not
  +     *  be <code>null</code>
  +     * @param types  array of Class objects representing parameter types,
  +     *  may be <code>null</code>
  +     * @param params  array of objects to pass as parameters, may
  +     *  be <code>null</code>
        * @param breakScope  whether to break scope restrictions using the
  -     *  <code>setAccessible</code> method. False will only match public methods.
  +     *  <code>setAccessible</code> method. <code>False</code> will only match
  +     *  public methods.
        * @return the newly created object
        * @throws ReflectionException if an error occurs during reflection
        * @throws IllegalArgumentException if the types and params lengths differ
  -     * @throws IllegalArgumentException if the class is null
  +     * @throws IllegalArgumentException if the class is <code>null</code>
        */
       public static Object newInstanceExact(Class cls, Class[] types, Object[] params, boolean breakScope) {
           if (ArrayUtils.isSameLength(types, params) == false) {
  
  
  
  1.2       +101 -75   jakarta-commons/lang/src/java/org/apache/commons/lang/reflect/FieldUtils.java
  
  Index: FieldUtils.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/lang/src/java/org/apache/commons/lang/reflect/FieldUtils.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FieldUtils.java	24 Oct 2002 23:12:54 -0000	1.1
  +++ FieldUtils.java	14 Jul 2003 22:29:04 -0000	1.2
  @@ -56,26 +56,29 @@
   import java.lang.reflect.Field;
   import java.lang.reflect.Modifier;
   /**
  - * <code>FieldUtils</code> contains utility methods for working with
  - * fields by reflection.
  - * <p>
  - * The ability is provided to break the scoping restrictions coded by the
  + * <p><code>FieldUtils</code> contains utility methods for working with
  + * fields by reflection.</p>
  + *
  + * <p>The ability is provided to break the scoping restrictions coded by the
    * programmer. This can allow fields to be changed that shouldn't be. This
  - * facility should be used with care.
  + * facility should be used with care.</p>
    *
    * @author <a href="mailto:scolebourne@apache.org">Stephen Colebourne</a>
    * @version $Id$
    */
   public class FieldUtils {
       
  -    /** An empty field array */
  +    /**
  +     * An empty field array.
  +     */
       public static final Field[] EMPTY_FIELD_ARRAY = new Field[0];
       
       /**
  -     * FieldUtils instances should NOT be constructed in standard programming.
  -     * Instead, the class should be used as <code>FieldUtils.getField(cls, name)</code>.
  +     * <p>FieldUtils instances should NOT be constructed in standard programming.</p>
  +     *
  +     * <p>Instead, the class should be used as <code>FieldUtils.getField(cls, name)</code>.
        * This constructor is public to permit tools that require a JavaBean instance
  -     * to operate.
  +     * to operate.</p>
        */
       public FieldUtils() {
       }
  @@ -83,13 +86,14 @@
       // -------------------------------------------------------------------------
       
       /**
  -     * Gets an accessible Field by name repecting scope.
  -     * Superclasses/interfaces will be considered.
  +     * <p>Gets an accessible <code>Field</code> by name repecting scope.
  +     * Superclasses/interfaces will be considered.</p>
        *
  -     * @param cls  the class to reflect, must not be null
  +     * @param cls  the class to reflect, must not be <code>null</code>
        * @param fieldName  the field name to obtain
        * @return the Field object
  -     * @throws IllegalArgumentException if the class or field name is null
  +     * @throws IllegalArgumentException if the class or field name
  +     *  is <code>null</code>
        * @throws ReflectionException if an error occurs during reflection
        */
       public static Field getField(Class cls, String fieldName) {
  @@ -97,15 +101,17 @@
       }
       
       /**
  -     * Gets an accessible Field by name breaking scope if requested.
  -     * Superclasses/interfaces will be considered.
  +     * <p>Gets an accessible <code>Field</code> by name breaking scope
  +     * if requested. Superclasses/interfaces will be considered.</p>
        *
  -     * @param cls  the class to reflect, must not be null
  +     * @param cls  the class to reflect, must not be <code>null</code>
        * @param fieldName  the field name to obtain
        * @param breakScope  whether to break scope restrictions using the
  -     *  <code>setAccessible</code> method. False will only match public fields.
  +     *  <code>setAccessible</code> method. <code>False</code> will only
  +     *  match public fields.
        * @return the Field object
  -     * @throws IllegalArgumentException if the class or field name is null
  +     * @throws IllegalArgumentException if the class or field name
  +     *  is <code>null</code>
        * @throws ReflectionException if an error occurs during reflection
        */
       public static Field getField(Class cls, String fieldName, boolean breakScope) {
  @@ -189,13 +195,14 @@
       // -------------------------------------------------------------------------
       
       /**
  -     * Gets an accessible Field by name respecting scope.
  -     * Only the specified class will be considered.
  +     * <p>Gets an accessible <code>Field</code> by name respecting scope.
  +     * Only the specified class will be considered.</p>
        *
  -     * @param cls  the class to reflect, must not be null
  +     * @param cls  the class to reflect, must not be <code>null</code>
        * @param fieldName  the field name to obtain
        * @return the Field object
  -     * @throws IllegalArgumentException if the class or field name is null
  +     * @throws IllegalArgumentException if the class or field name
  +     *  is <code>null</code>
        * @throws ReflectionException if an error occurs during reflection
        */
       public static Field getFieldExact(Class cls, String fieldName) {
  @@ -203,15 +210,16 @@
       }
       
       /**
  -     * Gets an accessible Field by name breaking scope if requested.
  -     * Only the specified class will be considered.
  +     * <p>Gets an accessible <code>Field</code> by name breaking scope
  +     * if requested. Only the specified class will be considered.</p>
        *
  -     * @param cls  the class to reflect, must not be null
  +     * @param cls  the class to reflect, must not be <code>null</code>
        * @param fieldName  the field name to obtain
        * @param breakScope  whether to break scope restrictions using the
        *  <code>setAccessible</code> method. False will only match public fields.
        * @return the Field object
  -     * @throws IllegalArgumentException if the class or field name is null
  +     * @throws IllegalArgumentException if the class or field name
  +     *  is <code>null</code>
        * @throws ReflectionException if an error occurs during reflection
        */
       public static Field getFieldExact(Class cls, String fieldName, boolean breakScope) {
  @@ -247,11 +255,12 @@
       // -------------------------------------------------------------------------
       
       /**
  -     * Gets a static Field value from a Field object.
  +     * <p>Gets a static Field value from a <code>Field</code> object.</p>
        * 
        * @param field  the field to use
        * @return the field value
  -     * @throws IllegalArgumentException if the field is null or not static
  +     * @throws IllegalArgumentException if the field is
  +     *  <code>null</code> or not static
        * @throws ReflectionException if an error occurs during reflection
        */
       public static Object getStaticFieldValue(Field field) {
  @@ -265,13 +274,15 @@
       }
       
       /**
  -     * Gets a static Field value from a Field object.
  +     * <p>Gets a static Field value from a <code>Field</code> object.</p>
        * 
        * @param field  the field to use
        * @param breakScope  whether to break scope restrictions using the
  -     *  <code>setAccessible</code> method. False will only match public methods.
  +     *  <code>setAccessible</code> method. <code>False</code> will only
  +     *  match public methods.
        * @return the field value
  -     * @throws IllegalArgumentException if the field is null or not static
  +     * @throws IllegalArgumentException if the field is <code>null</code>
  +     *  or not static
        * @throws ReflectionException if an error occurs during reflection
        */
       public static Object getStaticFieldValue(Field field, boolean breakScope) {
  @@ -285,12 +296,13 @@
       }
       
       /**
  -     * Gets a Field value from a Field object.
  +     * <p>Gets a Field value from a <code>Field</code> object.</p>
        * 
        * @param field  the field to use
  -     * @param object  the object to call on, may be null for static fields
  +     * @param object  the object to call on, may be <code>null</code>
  +     *  for static fields
        * @return the field value
  -     * @throws IllegalArgumentException if the field is null
  +     * @throws IllegalArgumentException if the field is <code>null</code>
        * @throws ReflectionException if an error occurs during reflection
        */
       public static Object getFieldValue(Field field, Object object) {
  @@ -298,14 +310,16 @@
       }
       
       /**
  -     * Gets a Field value from a Field object.
  +     * <p>Gets a Field value from a Field object.</p>
        * 
        * @param field  the field to use
  -     * @param object  the object to call on, may be null for static fields
  +     * @param object  the object to call on, may be <code>null</code>
  +     *  for static fields
        * @param breakScope  whether to break scope restrictions using the
  -     *  <code>setAccessible</code> method. False will only match public methods.
  +     *  <code>setAccessible</code> method. <code>False</code> will only
  +     *  match public methods.
        * @return the field value
  -     * @throws IllegalArgumentException if the field is null
  +     * @throws IllegalArgumentException if the field is <code>null</code>
        * @throws ReflectionException if an error occurs during reflection
        */
       public static Object getFieldValue(Field field, Object object, boolean breakScope) {
  @@ -332,13 +346,14 @@
       // -------------------------------------------------------------------------
       
       /**
  -     * Gets a static Field value by name. The field must be public.
  -     * Superclasses will be considered.
  +     * <p>Gets a static Field value by name. The field must be public.
  +     * Superclasses will be considered.</p>
        *
  -     * @param cls  the class to reflect, must not be null
  +     * @param cls  the class to reflect, must not be <code>null</code>
        * @param fieldName  the field name to obtain
        * @return the value of the field
  -     * @throws IllegalArgumentException if the class or field name is null
  +     * @throws IllegalArgumentException if the class or field name
  +     *  is <code>null</code>
        * @throws ReflectionException if an error occurs during reflection
        */
       public static Object getStaticFieldValue(Class cls, String fieldName) {
  @@ -346,15 +361,17 @@
       }
       
       /**
  -     * Gets a static Field value by name.
  -     * Only the specified class will be considered.
  +     * <p>Gets a static Field value by name. Only the specified class
  +     * will be considered.</p>
        *
  -     * @param cls  the class to reflect, must not be null
  +     * @param cls  the class to reflect, must not be <code>null</code>
        * @param fieldName  the field name to obtain
        * @param breakScope  whether to break scope restrictions using the
  -     *  <code>setAccessible</code> method. False will only match public fields.
  +     *  <code>setAccessible</code> method. <code>False</code> will only
  +     *  match public fields.
        * @return the Field object
  -     * @throws IllegalArgumentException if the class or field name is null
  +     * @throws IllegalArgumentException if the class or field name
  +     *  is <code>null</code>
        * @throws ReflectionException if an error occurs during reflection
        */
       public static Object getStaticFieldValue(Class cls, String fieldName, boolean breakScope) {
  @@ -379,13 +396,14 @@
       // -------------------------------------------------------------------------
       
       /**
  -     * Gets a static Field value by name. The field must be public.
  -     * Only the specified class will be considered.
  +     * <p>Gets a static Field value by name. The field must be public.
  +     * Only the specified class will be considered.</p>
        *
  -     * @param cls  the class to reflect, must not be null
  +     * @param cls  the class to reflect, must not be <code>null</code>
        * @param fieldName  the field name to obtain
        * @return the value of the field
  -     * @throws IllegalArgumentException if the class or field name is null
  +     * @throws IllegalArgumentException if the class or field name
  +     *  is <code>null</code>
        * @throws ReflectionException if an error occurs during reflection
        */
       public static Object getStaticFieldValueExact(Class cls, String fieldName) {
  @@ -393,15 +411,17 @@
       }
       
       /**
  -     * Gets a static Field value by name.
  -     * Only the specified class will be considered.
  +     * <p>Gets a static Field value by name. Only the specified class will
  +     * be considered.</p>
        *
  -     * @param cls  the class to reflect, must not be null
  +     * @param cls  the class to reflect, must not be <code>null</code>
        * @param fieldName  the field name to obtain
        * @param breakScope  whether to break scope restrictions using the
  -     *  <code>setAccessible</code> method. False will only match public fields.
  +     *  <code>setAccessible</code> method. <code>False</code> will only
  +     *  match public fields.
        * @return the Field object
  -     * @throws IllegalArgumentException if the class or field name is null
  +     * @throws IllegalArgumentException if the class or field name
  +     *  is <code>null</code>
        * @throws ReflectionException if an error occurs during reflection
        */
       public static Object getStaticFieldValueExact(Class cls, String fieldName, boolean breakScope) {
  @@ -426,13 +446,14 @@
       // -------------------------------------------------------------------------
       
       /**
  -     * Gets a Field value by name. The field must be public.
  -     * Superclasses will be considered.
  +     * <p>Gets a Field value by name. The field must be public. Superclasses
  +     * will be considered.</p>
        *
  -     * @param object  the object to reflect, must not be null
  +     * @param object  the object to reflect, must not be <code>null</code>
        * @param fieldName  the field name to obtain
        * @return the value of the field
  -     * @throws IllegalArgumentException if the class or field name is null
  +     * @throws IllegalArgumentException if the class or field name
  +     *  is <code>null</code>
        * @throws ReflectionException if an error occurs during reflection
        */
       public static Object getFieldValue(Object object, String fieldName) {
  @@ -440,15 +461,17 @@
       }
       
       /**
  -     * Gets a Field value by name.
  -     * Only the specified class will be considered.
  +     * <p>Gets a Field value by name. Only the specified class will be
  +     * considered.</p>
        *
  -     * @param object  the object to reflect, must not be null
  +     * @param object  the object to reflect, must not be <code>null</code>
        * @param fieldName  the field name to obtain
        * @param breakScope  whether to break scope restrictions using the
  -     *  <code>setAccessible</code> method. False will only match public fields.
  +     *  <code>setAccessible</code> method. <code>False</code> will only
  +     *  match public fields.
        * @return the Field object
  -     * @throws IllegalArgumentException if the class or field name is null
  +     * @throws IllegalArgumentException if the class or field name
  +     *  is <code>null</code>
        * @throws ReflectionException if an error occurs during reflection
        */
       public static Object getFieldValue(Object object, String fieldName, boolean breakScope) {
  @@ -459,13 +482,14 @@
       // -------------------------------------------------------------------------
       
       /**
  -     * Gets a Field value by name. The field must be public.
  -     * Only the class of the specified object will be considered.
  +     * <p>Gets a Field value by name. The field must be public.
  +     * Only the class of the specified object will be considered.</p>
        *
  -     * @param object  the object to reflect, must not be null
  +     * @param object  the object to reflect, must not be <code>null</code>
        * @param fieldName  the field name to obtain
        * @return the value of the field
  -     * @throws IllegalArgumentException if the class or field name is null
  +     * @throws IllegalArgumentException if the class or field name
  +     *  is <code>null</code>
        * @throws ReflectionException if an error occurs during reflection
        */
       public static Object getFieldValueExact(Object object, String fieldName) {
  @@ -473,15 +497,17 @@
       }
       
       /**
  -     * Gets a Field value by name.
  -     * Only the class of the specified object will be considered.
  +     * <p<>Gets a Field value by name. Only the class of the specified
  +     * object will be considered.</p>
        *
  -     * @param object  the object to reflect, must not be null
  +     * @param object  the object to reflect, must not be <code>null</code>
        * @param fieldName  the field name to obtain
        * @param breakScope  whether to break scope restrictions using the
  -     *  <code>setAccessible</code> method. False will only match public fields.
  +     *  <code>setAccessible</code> method. <code>False</code> will only
  +     *  match public fields.
        * @return the Field object
  -     * @throws IllegalArgumentException if the class or field name is null
  +     * @throws IllegalArgumentException if the class or field name
  +     *  is <code>null</code>
        * @throws ReflectionException if an error occurs during reflection
        */
       public static Object getFieldValueExact(Object object, String fieldName, boolean breakScope) {
  
  
  
  1.12      +54 -42    jakarta-commons/lang/src/java/org/apache/commons/lang/reflect/MethodUtils.java
  
  Index: MethodUtils.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/lang/src/java/org/apache/commons/lang/reflect/MethodUtils.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- MethodUtils.java	25 Jan 2003 13:01:38 -0000	1.11
  +++ MethodUtils.java	14 Jul 2003 22:29:04 -0000	1.12
  @@ -60,12 +60,12 @@
   
   import org.apache.commons.lang.ArrayUtils;
   /**
  - * <code>MethodUtils</code> contains utility methods for working for
  - * methods by reflection.
  - * <p>
  - * The ability is provided to break the scoping restrictions coded by the
  + * <p><code>MethodUtils</code> contains utility methods for working for
  + * methods by reflection.</p>
  + *
  + * <p>The ability is provided to break the scoping restrictions coded by the
    * programmer. This can break an implementation if used incorrectly. This
  - * facility should be used with care.
  + * facility should be used with care.</p>
    *
    * @author <a href="mailto:scolebourne@apache.org">Stephen Colebourne</a>
    * @author Based on code from <code>BeanUtils</code> by: Craig R. McClanahan
  @@ -82,14 +82,17 @@
       
       public static final boolean debug = false;
       
  -    /** An empty method array */
  +    /**
  +     * An empty method array.
  +     */
       public static final Method[] EMPTY_METHOD_ARRAY = new Method[0];
       
       /**
  -     * MethodUtils instances should NOT be constructed in standard programming.
  -     * Instead, the class should be used as <code>MethodUtils.getMethod(cls, name)</code>.
  +     * <p>MethodUtils instances should NOT be constructed in standard programming.</p>
  +     *
  +     * <p>Instead, the class should be used as <code>MethodUtils.getMethod(cls, name)</code>.
        * This constructor is public to permit tools that require a JavaBean instance
  -     * to operate.
  +     * to operate.</p>
        */
       public MethodUtils() {
       }
  @@ -97,13 +100,14 @@
       // -------------------------------------------------------------------------
       
       /**
  -     * Gets a Method by name. The method must be public and take no parameters.
  -     * Superclasses will be considered.
  +     * <p>Gets a <code>Method</code> by name. The method must be public and take
  +     * no parameters. Superclasses will be considered.</p>
        *
  -     * @param cls  the class to reflect, must not be null
  +     * @param cls  the class to reflect, must not be <code>null</code>
        * @param methodName  the field name to obtain
        * @return the Method object
  -     * @throws IllegalArgumentException if the class or method name is null
  +     * @throws IllegalArgumentException if the class or method name
  +     *  is <code>null</code>
        * @throws ReflectionException if an error occurs during reflection
        */
       public static Method getMethod(Class cls, String methodName) {
  @@ -111,13 +115,14 @@
       }
       
       /**
  -     * Gets a Method by name. The method must be public.
  -     * Superclasses will be considered.
  +     * <p>Gets a <code>Method</code> by name. The method must be public.
  +     * Superclasses will be considered.</p>
        *
  -     * @param cls  the class to reflect, must not be null
  +     * @param cls  the class to reflect, must not be <code>null</code>
        * @param methodName  the field name to obtain
        * @return the Method object
  -     * @throws IllegalArgumentException if the class or method name is null
  +     * @throws IllegalArgumentException if the class or method name
  +     *  is <code>null</code>
        * @throws ReflectionException if an error occurs during reflection
        */
       public static Method getMethod(Class cls, String methodName, Class paramType) {
  @@ -126,13 +131,14 @@
       }
       
       /**
  -     * Gets a Method by name. The method must be public.
  -     * Superclasses will be considered.
  +     * <p>Gets a <code>Method</code> by name.</p> The method must be public.
  +     * Superclasses will be considered.</p>
        *
  -     * @param cls  the class to reflect, must not be null
  +     * @param cls  the class to reflect, must not be <code>null</code>
        * @param methodName  the field name to obtain
        * @return the Method object
  -     * @throws IllegalArgumentException if the class or method name is null
  +     * @throws IllegalArgumentException if the class or method name
  +     *  is <code>null</code>
        * @throws ReflectionException if an error occurs during reflection
        */
       public static Method getMethod(Class cls, String methodName, Class[] paramTypes) {
  @@ -140,15 +146,16 @@
       }
       
       /**
  -     * Gets a Method by name.
  -     * Superclasses will be considered.
  +     * <p>Gets a <code>Method</code> by name. Superclasses will be considered.</p>
        *
  -     * @param cls  the class to reflect, must not be null
  +     * @param cls  the class to reflect, must not be <code>null</code>
        * @param methodName  the method name to obtain
        * @param breakScope  whether to break scope restrictions using the
  -     *  <code>setAccessible</code> method. False will only match public fields.
  +     *  <code>setAccessible</code> method. <code>False</code> will only
  +     *  match public fields.
        * @return the Method object
  -     * @throws IllegalArgumentException if the class or field name is null
  +     * @throws IllegalArgumentException if the class or field name
  +     *  is <code>null</code>
        * @throws ReflectionException if an error occurs during reflection
        */
       public static Method getMethod(Class cls, String methodName, Class[] paramTypes, boolean breakScope) {
  @@ -215,8 +222,8 @@
   
       /**
        * <p>Return an accessible method (that is, one that can be invoked via
  -     * reflection) that implements the specified Method.  If no such method
  -     * can be found, return <code>null</code>.</p>
  +     * reflection) that implements the specified <code>Method</code>. If
  +     * no such method can be found, return <code>null</code>.</p>
        *
        * @param method The method that we wish to call
        */
  @@ -270,12 +277,14 @@
        * {@link #invokeMethod(Object object,String methodName,Object [] args)}.
        * </p>
        *
  -     * @param objectToInvoke  invoke method on this object, must not be null
  -     * @param methodName  get method with this name, must not be null
  -     * @param arg  use this argument, must not be null
  -     *
  +     * @param objectToInvoke  invoke method on this object, must
  +     *  not be <code>null</code>
  +     * @param methodName  get method with this name, must not
  +     *  be <code>null</code>
  +     * @param arg  use this argument, must not be <code>null</code>
        * @throws ReflectionException if an error occurs during reflection
  -     * @throws IllegalArgumentException if any parameter is null
  +     * @throws IllegalArgumentException if any parameter is
  +     *  <code>null</code>
        */
       public static Object invokeMethod(
               Object objectToInvoke,
  @@ -305,15 +314,18 @@
        * would match a <code>boolean</code> primitive.</p>
        *
        * <p> This is a convenient wrapper for
  -     * {@link #invokeMethod(Object object,String methodName,Object [] args,Class[] parameterTypes)}.
  +     * {@link #invokeMethod(Object object, String methodName, Object[] args, Class[] parameterTypes)}.
        * </p>
        *
  -     * @param objectToInvoke  invoke method on this object, must not be null
  -     * @param methodName  get method with this name, must not be null
  -     * @param args  use these arguments - treat null as empty array
  -     *
  +     * @param objectToInvoke  invoke method on this object, must not
  +     *  be <code>null</code>
  +     * @param methodName  get method with this name, must not
  +     *  be <code>null</code>
  +     * @param args  use these arguments - treat <code>null</code>
  +     *  as empty array
        * @throws ReflectionException if an error occurs during reflection
  -     * @throws IllegalArgumentException if the objectToInvoke, methodName or any argument is null
  +     * @throws IllegalArgumentException if the objectToInvoke, methodName
  +     *  or any argument is <code>null</code>
        */
       public static Object invokeMethod(
               Object objectToInvoke,
  @@ -354,8 +366,8 @@
        * @param object  invoke method on this object
        * @param methodName  get method with this name
        * @param args  use these arguments - treat null as empty array
  -     * @param parameterTypes  match these parameters - treat null as empty array
  -     *
  +     * @param parameterTypes  match these parameters - treat
  +     *  <code>null</code> as empty array
        * @throws ReflectionException if an error occurs during reflection
        */
       public static Object invokeMethod(
  
  
  
  1.2       +14 -14    jakarta-commons/lang/src/java/org/apache/commons/lang/reflect/ReflectionException.java
  
  Index: ReflectionException.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/lang/src/java/org/apache/commons/lang/reflect/ReflectionException.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ReflectionException.java	24 Oct 2002 23:12:54 -0000	1.1
  +++ ReflectionException.java	14 Jul 2003 22:29:04 -0000	1.2
  @@ -55,8 +55,8 @@
   
   import org.apache.commons.lang.exception.NestableRuntimeException;
   /**
  - * Exception thrown when the Reflection process fails. The original
  - * error is wrapped within this one.
  + * <p>Exception thrown when the Reflection process fails. The original
  + * error is wrapped within this one.</p>
    *
    * @author <a href="mailto:scolebourne@joda.org">Stephen Colebourne</a>
    * @version $Id$
  @@ -64,16 +64,16 @@
   public class ReflectionException extends NestableRuntimeException {
   
       /**
  -     * Constructs a new <code>ReflectionException</code> without specified
  -     * detail message.
  +     * <p>Constructs a new <code>ReflectionException</code> without specified
  +     * detail message.</p>
        */
       public ReflectionException() {
           super();
       }
   
       /**
  -     * Constructs a new <code>ReflectionException</code> with specified
  -     * detail message.
  +     * <p>Constructs a new <code>ReflectionException</code> with specified
  +     * detail message.</p>
        *
        * @param msg  The error message.
        */
  @@ -82,23 +82,23 @@
       }
   
       /**
  -     * Constructs a new <code>ReflectionException</code> with specified
  -     * nested <code>Throwable</code>.
  +     * <p>Constructs a new <code>ReflectionException</code> with specified
  +     * nested <code>Throwable</code>.</p>
        *
        * @param cause  The exception or error that caused this exception
  -     *               to be thrown.
  +     *  to be thrown.
        */
       public ReflectionException(Throwable cause) {
           super(cause);
       }
   
       /**
  -     * Constructs a new <code>ReflectionException</code> with specified
  -     * detail message and nested <code>Throwable</code>.
  +     * <p>Constructs a new <code>ReflectionException</code> with specified
  +     * detail message and nested <code>Throwable</code>.</p>
        *
  -     * @param msg    The error message.
  +     * @param msg  The error message.
        * @param cause  The exception or error that caused this exception
  -     *               to be thrown.
  +     *  to be thrown.
        */
       public ReflectionException(String msg, Throwable cause) {
           super(msg, cause);
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message