This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch 1.X in repository https://gitbox.apache.org/repos/asf/commons-beanutils.git
commit 19ed6383104c175de4b73244fe36a24ed104a5e6 Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Sun Dec 8 11:31:10 2024 -0500 Fix Javadoc generation on Java 8 and up --- .../apache/commons/beanutils/BasicDynaBean.java | 3 +- .../apache/commons/beanutils/BasicDynaClass.java | 56 +-------------- .../java/org/apache/commons/beanutils/BeanMap.java | 14 ++-- .../beanutils/BeanPropertyValueChangeClosure.java | 21 +++--- .../BeanPropertyValueEqualsPredicate.java | 20 +++--- .../beanutils/BeanToPropertyValueTransformer.java | 9 ++- .../org/apache/commons/beanutils/BeanUtils.java | 44 +----------- .../apache/commons/beanutils/BeanUtilsBean.java | 10 +-- .../apache/commons/beanutils/ConstructorUtils.java | 7 +- .../commons/beanutils/ContextClassLoaderLocal.java | 4 +- .../apache/commons/beanutils/ConvertUtilsBean.java | 2 +- .../org/apache/commons/beanutils/DynaBean.java | 13 +--- .../commons/beanutils/DynaBeanMapDecorator.java | 17 +++-- .../beanutils/DynaBeanPropertyMapDecorator.java | 14 ++-- .../org/apache/commons/beanutils/DynaClass.java | 11 +-- .../beanutils/FluentPropertyBeanIntrospector.java | 5 +- .../apache/commons/beanutils/JDBCDynaClass.java | 4 +- .../org/apache/commons/beanutils/LazyDynaBean.java | 42 +++++++----- .../org/apache/commons/beanutils/LazyDynaList.java | 11 +-- .../org/apache/commons/beanutils/MethodUtils.java | 20 +++--- .../commons/beanutils/ResultSetIterator.java | 60 +--------------- .../org/apache/commons/beanutils/WrapDynaBean.java | 41 +---------- .../apache/commons/beanutils/WrapDynaClass.java | 64 +++-------------- .../beanutils/converters/AbstractConverter.java | 2 +- .../beanutils/converters/ArrayConverter.java | 22 +++--- .../converters/BooleanArrayConverter.java | 2 +- .../beanutils/converters/BooleanConverter.java | 16 ++--- .../beanutils/converters/ConverterFacade.java | 3 +- .../beanutils/converters/DateTimeConverter.java | 19 +++-- .../beanutils/converters/NumberConverter.java | 15 ++-- .../beanutils/converters/SqlTimeConverter.java | 2 +- .../converters/SqlTimestampConverter.java | 2 +- .../beanutils/converters/StringConverter.java | 4 +- .../commons/beanutils/converters/package-info.java | 4 +- .../commons/beanutils/expression/Resolver.java | 14 ++-- .../beanutils/locale/converters/package-info.java | 4 +- .../org/apache/commons/beanutils/package-info.java | 80 +++++++--------------- 37 files changed, 208 insertions(+), 473 deletions(-) diff --git a/src/main/java/org/apache/commons/beanutils/BasicDynaBean.java b/src/main/java/org/apache/commons/beanutils/BasicDynaBean.java index c8e83b6b..97e5f812 100644 --- a/src/main/java/org/apache/commons/beanutils/BasicDynaBean.java +++ b/src/main/java/org/apache/commons/beanutils/BasicDynaBean.java @@ -258,9 +258,10 @@ public class BasicDynaBean implements DynaBean, Serializable { /** * Return a Map representation of this DynaBean. - * </p> + * <p> * This, for example, could be used in JSTL in the following way to access * a DynaBean's <code>fooProperty</code>: + * </p> * <ul><li><code>${myDynaBean.<strong>map</strong>.fooProperty}</code></li></ul> * * @return a Map representation of this DynaBean diff --git a/src/main/java/org/apache/commons/beanutils/BasicDynaClass.java b/src/main/java/org/apache/commons/beanutils/BasicDynaClass.java index 149ed491..63390b0c 100644 --- a/src/main/java/org/apache/commons/beanutils/BasicDynaClass.java +++ b/src/main/java/org/apache/commons/beanutils/BasicDynaClass.java @@ -15,16 +15,13 @@ * limitations under the License. */ - package org.apache.commons.beanutils; - import java.io.Serializable; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.util.HashMap; - /** * <p>Minimal implementation of the <code>DynaClass</code> interface. Can be * used as a convenience base class for more sophisticated implementations.</p> * @@ -34,57 +31,44 @@ import java.util.HashMap; * used to associate the DynaBean instance with this DynaClass.</p> * */ - public class BasicDynaClass implements DynaClass, Serializable { - - - private static final long serialVersionUID = 1L; - /** * The method signature of the constructor we will use to create * new DynaBean instances. */ protected static Class<?>[] constructorTypes = { DynaClass.class }; - /** * The constructor of the <code>dynaBeanClass</code> that we will use * for creating new instances. */ protected transient Constructor<?> constructor = null; - /** * The argument values to be passed to the constructore we will use * to create new DynaBean instances. */ protected Object[] constructorValues = { this }; - - - /** * The <code>DynaBean</code> implementation class we will use for * creating new instances. */ protected Class<?> dynaBeanClass = BasicDynaBean.class; - /** * The "name" of this DynaBean class. */ protected String name = this.getClass().getName(); - /** * The set of dynamic properties that are part of this DynaClass. */ protected DynaProperty[] properties = {}; - /** * The set of dynamic properties that are part of this DynaClass, * keyed by the property name. Individual descriptor instances will @@ -92,17 +76,13 @@ public class BasicDynaClass implements DynaClass, Serializable { */ protected HashMap<String, DynaProperty> propertiesMap = new HashMap<>(); - /** * Construct a new BasicDynaClass with default parameters. */ public BasicDynaClass() { - this(null, null, null); - } - /** * Construct a new BasicDynaClass with the specified parameters. * @@ -110,12 +90,9 @@ public class BasicDynaClass implements DynaClass, Serializable { * @param dynaBeanClass The implementation class for new instances */ public BasicDynaClass(final String name, final Class<?> dynaBeanClass) { - this(name, dynaBeanClass, null); - } - /** * Construct a new BasicDynaClass with the specified parameters. * @@ -125,7 +102,6 @@ public class BasicDynaClass implements DynaClass, Serializable { */ public BasicDynaClass(final String name, Class<?> dynaBeanClass, final DynaProperty[] properties) { - if (name != null) { this.name = name; } @@ -136,12 +112,8 @@ public class BasicDynaClass implements DynaClass, Serializable { if (properties != null) { setProperties(properties); } - } - - - /** * Return the Class object we will use to create new instances in the * <code>newInstance()</code> method. This Class <strong>MUST</strong> @@ -150,12 +122,9 @@ public class BasicDynaClass implements DynaClass, Serializable { * @return The class of the {@link DynaBean} */ public Class<?> getDynaBeanClass() { - return this.dynaBeanClass; - } - /** * <p>Return an array of <code>ProperyDescriptors</code> for the properties * currently defined in this DynaClass. If no properties are defined, a @@ -169,12 +138,9 @@ public class BasicDynaClass implements DynaClass, Serializable { */ @Override public DynaProperty[] getDynaProperties() { - return properties; - } - /** * Return a property descriptor for the specified property, if it exists; * otherwise, return <code>null</code>. @@ -186,19 +152,16 @@ public class BasicDynaClass implements DynaClass, Serializable { */ @Override public DynaProperty getDynaProperty(final String name) { - if (name == null) { throw new IllegalArgumentException ("No property name specified"); } return propertiesMap.get(name); - } - /** * Return the name of this DynaClass (analogous to the - * <code>getName()</code> method of <code>java.lang.Class</code), which + * <code>getName()</code> method of <code>java.lang.Class</code>), which * allows the same <code>DynaClass</code> implementation class to support * different dynamic classes, with different sets of properties. * @@ -206,14 +169,9 @@ public class BasicDynaClass implements DynaClass, Serializable { */ @Override public String getName() { - return this.name; - } - - - /** * Instantiate and return a new DynaBean instance, associated * with this DynaClass. @@ -228,7 +186,6 @@ public class BasicDynaClass implements DynaClass, Serializable { @Override public DynaBean newInstance() throws IllegalAccessException, InstantiationException { - try { // Refind the constructor after a deserialization (if needed) if (constructor == null) { @@ -240,12 +197,8 @@ public class BasicDynaClass implements DynaClass, Serializable { throw new InstantiationException (e.getTargetException().getMessage()); } - } - - - /** * Set the Class object we will use to create new instances in the * <code>newInstance()</code> method. This Class <strong>MUST</strong> @@ -256,7 +209,6 @@ public class BasicDynaClass implements DynaClass, Serializable { * implement the <code>DynaBean</code> interface */ protected void setDynaBeanClass(final Class<?> dynaBeanClass) { - // Validate the argument type specified if (dynaBeanClass.isInterface()) { throw new IllegalArgumentException @@ -268,7 +220,6 @@ public class BasicDynaClass implements DynaClass, Serializable { ("Class " + dynaBeanClass.getName() + " does not implement DynaBean"); } - // Identify the Constructor we will use in newInstance() try { this.constructor = dynaBeanClass.getConstructor(constructorTypes); @@ -278,24 +229,19 @@ public class BasicDynaClass implements DynaClass, Serializable { " does not have an appropriate constructor"); } this.dynaBeanClass = dynaBeanClass; - } - /** * Set the list of dynamic properties supported by this DynaClass. * * @param properties List of dynamic properties to be supported */ protected void setProperties(final DynaProperty[] properties) { - this.properties = properties; propertiesMap.clear(); for (final DynaProperty propertie : properties) { propertiesMap.put(propertie.getName(), propertie); } - } - } diff --git a/src/main/java/org/apache/commons/beanutils/BeanMap.java b/src/main/java/org/apache/commons/beanutils/BeanMap.java index a5b858cb..ffb1733c 100644 --- a/src/main/java/org/apache/commons/beanutils/BeanMap.java +++ b/src/main/java/org/apache/commons/beanutils/BeanMap.java @@ -253,22 +253,22 @@ public class BeanMap extends AbstractMap<Object, Object> implements Cloneable { * <ul> * <li>If there is no underlying bean, return a cloned BeanMap without a * bean. - * + * </li> * <li>Since there is an underlying bean, try to instantiate a new bean of * the same type using Class.newInstance(). - * + * </li> * <li>If the instantiation fails, throw a CloneNotSupportedException - * + * </li> * <li>Clone the bean map and set the newly instantiated bean as the * underlying bean for the bean map. - * + * </li> * <li>Copy each property that is both readable and writable from the * existing object to a cloned bean map. - * + * </li> * <li>If anything fails along the way, throw a * CloneNotSupportedException. - * - * <ul> + * </li> + * </ul> * * @return a cloned instance of this bean map * @throws CloneNotSupportedException if the underlying bean diff --git a/src/main/java/org/apache/commons/beanutils/BeanPropertyValueChangeClosure.java b/src/main/java/org/apache/commons/beanutils/BeanPropertyValueChangeClosure.java index 31ea15f6..04b02677 100644 --- a/src/main/java/org/apache/commons/beanutils/BeanPropertyValueChangeClosure.java +++ b/src/main/java/org/apache/commons/beanutils/BeanPropertyValueChangeClosure.java @@ -33,9 +33,9 @@ import org.apache.commons.logging.LogFactory; * what property will be updated and with what value. * <dl> * <dt> - * <b><code> - * <pre>public BeanPropertyValueChangeClosure( String propertyName, Object propertyValue )</pre> - * </code></b> + * <b> + * <code>public BeanPropertyValueChangeClosure(String propertyName, Object propertyValue)</code> + * </b> * </dt> * <dd> * Will create a <code>Closure</code> that will update an object by setting the property @@ -43,25 +43,26 @@ import org.apache.commons.logging.LogFactory; * </dd> * </dl> * - * <p/> + * <p> * <strong>Note:</strong> Property names can be a simple, nested, indexed, or mapped property as defined by * <code>org.apache.commons.beanutils.PropertyUtils</code>. If any object in the property path * specified by <code>propertyName</code> is <code>null</code> then the outcome is based on the * value of the <code>ignoreNull</code> attribute. - * - * <p/> + * </p> + * <p> * A typical usage might look like: - * <code><pre> + * </p> + * <pre> * // create the closure * BeanPropertyValueChangeClosure closure = * new BeanPropertyValueChangeClosure( "activeEmployee", Boolean.TRUE ); * * // update the Collection * CollectionUtils.forAllDo( peopleCollection, closure ); - * </pre></code> - * <p/> - * + * </pre> + * <p> * This would take a <code>Collection</code> of person objects and update the + * </p> * <code>activeEmployee</code> property of each object in the <code>Collection</code> to * <code>true</code>. Assuming... * <ul> diff --git a/src/main/java/org/apache/commons/beanutils/BeanPropertyValueEqualsPredicate.java b/src/main/java/org/apache/commons/beanutils/BeanPropertyValueEqualsPredicate.java index 20db8344..e490f06a 100644 --- a/src/main/java/org/apache/commons/beanutils/BeanPropertyValueEqualsPredicate.java +++ b/src/main/java/org/apache/commons/beanutils/BeanPropertyValueEqualsPredicate.java @@ -33,10 +33,11 @@ import org.apache.commons.logging.LogFactory; * The <code>BeanPropertyValueEqualsPredicate</code> constructor takes two parameters which * determine what property will be evaluated on the target object and what its expected value should * be. + * </p> * <dl> * <dt> * <strong><code> - * <pre>public BeanPropertyValueEqualsPredicate( String propertyName, Object propertyValue )</pre> + * public BeanPropertyValueEqualsPredicate(String propertyName, Object propertyValue) * </code></strong> * </dt> * <dd> @@ -46,7 +47,6 @@ import org.apache.commons.logging.LogFactory; * <code>false</code> otherwise. * </dd> * </dl> - * </p> * <p> * <strong>Note:</strong> Property names can be a simple, nested, indexed, or mapped property as defined by * <code>org.apache.commons.beanutils.PropertyUtils</code>. If any object in the property path @@ -55,18 +55,19 @@ import org.apache.commons.logging.LogFactory; * </p> * <p> * A typical usage might look like: - * <code><pre> + * </p> + * <pre> * // create the closure * BeanPropertyValueEqualsPredicate predicate = * new BeanPropertyValueEqualsPredicate( "activeEmployee", Boolean.FALSE ); * * // filter the Collection * CollectionUtils.filter( peopleCollection, predicate ); - * </pre></code> - * </p> + * </pre> * <p> * This would take a <code>Collection</code> of person objects and filter out any people whose * <code>activeEmployee</code> property is <code>false</code>. Assuming... + * </p> * <ul> * <li> * The top level object in the <code>peeopleCollection</code> is an object which represents a @@ -77,20 +78,20 @@ import org.apache.commons.logging.LogFactory; * the boolean value for the object's <code>activeEmployee</code> property. * </li> * </ul> - * </p> * <p> * Another typical usage might look like: - * <code><pre> + * </p> + * <pre> * // create the closure * BeanPropertyValueEqualsPredicate predicate = * new BeanPropertyValueEqualsPredicate( "personId", "456-12-1234" ); * * // search the Collection * CollectionUtils.find( peopleCollection, predicate ); - * </pre></code> - * </p> + * </pre> * <p> * This would search a <code>Collection</code> of person objects and return the first object whose + * </p> * <code>personId</code> property value equals <code>456-12-1234</code>. Assuming... * <ul> * <li> @@ -102,7 +103,6 @@ import org.apache.commons.logging.LogFactory; * the value for the object's <code>personId</code> property. * </li> * </ul> - * </p> * * @see org.apache.commons.beanutils.PropertyUtils * @see org.apache.commons.collections.Predicate diff --git a/src/main/java/org/apache/commons/beanutils/BeanToPropertyValueTransformer.java b/src/main/java/org/apache/commons/beanutils/BeanToPropertyValueTransformer.java index 0427f613..59235646 100644 --- a/src/main/java/org/apache/commons/beanutils/BeanToPropertyValueTransformer.java +++ b/src/main/java/org/apache/commons/beanutils/BeanToPropertyValueTransformer.java @@ -35,21 +35,20 @@ import org.apache.commons.logging.LogFactory; * object in the property path specified by <code>propertyName</code> is <code>null</code> then the * outcome is based on the value of the <code>ignoreNull</code> attribute. * </p> - * * <p> * A typical usage might look like: - * <code><pre> + * </p> + * <pre> * // create the transformer * BeanToPropertyValueTransformer transformer = new BeanToPropertyValueTransformer( "person.address.city" ); * * // transform the Collection * Collection peoplesCities = CollectionUtils.collect( peopleCollection, transformer ); - * </pre></code> - * </p> - * + * </pre> * <p> * This would take a <code>Collection</code> of person objects and return a <code>Collection</code> * of objects which represents the cities in which each person lived. Assuming... + * </p> * <ul> * <li> * The top level object in the <code>peeopleCollection</code> is an object which represents a diff --git a/src/main/java/org/apache/commons/beanutils/BeanUtils.java b/src/main/java/org/apache/commons/beanutils/BeanUtils.java index f0c2bccb..21cccdd0 100644 --- a/src/main/java/org/apache/commons/beanutils/BeanUtils.java +++ b/src/main/java/org/apache/commons/beanutils/BeanUtils.java @@ -15,14 +15,11 @@ * limitations under the License. */ - package org.apache.commons.beanutils; import java.lang.reflect.InvocationTargetException; import java.util.Map; - - /** * <p>Utility methods for populating JavaBeans properties via reflection.</p> * @@ -32,12 +29,8 @@ import java.util.Map; * * @see BeanUtilsBean */ - public class BeanUtils { - - - /** * The debugging detail level for this component. * @@ -74,9 +67,7 @@ public class BeanUtils { public static Object cloneBean(final Object bean) throws IllegalAccessException, InstantiationException, InvocationTargetException, NoSuchMethodException { - return BeanUtilsBean.getInstance().cloneBean(bean); - } /** @@ -99,12 +90,9 @@ public class BeanUtils { */ public static void copyProperties(final Object dest, final Object orig) throws IllegalAccessException, InvocationTargetException { - BeanUtilsBean.getInstance().copyProperties(dest, orig); } - - /** * <p>Copy the specified property value to the specified destination bean, * performing any type conversion that is required.</p> @@ -122,11 +110,9 @@ public class BeanUtils { */ public static void copyProperty(final Object bean, final String name, final Object value) throws IllegalAccessException, InvocationTargetException { - BeanUtilsBean.getInstance().copyProperty(bean, name, value); } - /** * Create a cache. * @param <K> the key type of the cache @@ -138,7 +124,6 @@ public class BeanUtils { return new WeakFastHashMap<>(); } - /** * <p>Return the entire set of properties for which the specified bean * provides a read method.</p> @@ -158,11 +143,9 @@ public class BeanUtils { public static Map<String, String> describe(final Object bean) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException { - return BeanUtilsBean.getInstance().describe(bean); } - /** * <p>Return the value of the specified array property of the specified * bean, as a String array.</p> @@ -183,11 +166,9 @@ public class BeanUtils { public static String[] getArrayProperty(final Object bean, final String name) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException { - return BeanUtilsBean.getInstance().getArrayProperty(bean, name); } - /** * Return whether a Map is fast * @param map The map @@ -201,7 +182,6 @@ public class BeanUtils { return false; } - /** * The <code>debug</code> static property is no longer used * @return debug property @@ -214,7 +194,6 @@ public class BeanUtils { return debug; } - /** * <p>Return the value of the specified indexed property of the specified * bean, as a String.</p> @@ -236,12 +215,9 @@ public class BeanUtils { public static String getIndexedProperty(final Object bean, final String name) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException { - return BeanUtilsBean.getInstance().getIndexedProperty(bean, name); - } - /** * Return the value of the specified indexed property of the specified * bean, as a String. The index is specified as a method parameter and @@ -265,14 +241,12 @@ public class BeanUtils { final String name, final int index) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException { - return BeanUtilsBean.getInstance().getIndexedProperty(bean, name, index); } - /** - * </p>Return the value of the specified indexed property of the specified + * <p>Return the value of the specified indexed property of the specified * bean, as a String.</p> * * <p>For more details see <code>BeanUtilsBean</code>.</p> @@ -292,14 +266,11 @@ public class BeanUtils { public static String getMappedProperty(final Object bean, final String name) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException { - return BeanUtilsBean.getInstance().getMappedProperty(bean, name); - } - /** - * </p>Return the value of the specified mapped property of the specified + * <p>Return the value of the specified mapped property of the specified * bean, as a String.</p> * * <p>For more details see <code>BeanUtilsBean</code>.</p> @@ -320,12 +291,10 @@ public class BeanUtils { final String name, final String key) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException { - return BeanUtilsBean.getInstance().getMappedProperty(bean, name, key); } - /** * <p>Return the value of the (possibly nested) property of the specified * name, for the specified bean, as a String.</p> @@ -348,12 +317,10 @@ public class BeanUtils { public static String getNestedProperty(final Object bean, final String name) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException { - return BeanUtilsBean.getInstance().getNestedProperty(bean, name); } - /** * <p>Return the value of the specified property of the specified bean, * no matter which property reference format is used, as a String.</p> @@ -375,9 +342,7 @@ public class BeanUtils { public static String getProperty(final Object bean, final String name) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException { - return BeanUtilsBean.getInstance().getProperty(bean, name); - } @@ -401,12 +366,9 @@ public class BeanUtils { public static String getSimpleProperty(final Object bean, final String name) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException { - return BeanUtilsBean.getInstance().getSimpleProperty(bean, name); - } - /** * If we're running on JDK 1.4 or later, initialize the cause for the given throwable. * @@ -441,7 +403,6 @@ public class BeanUtils { */ public static void populate(final Object bean, final Map<String, ? extends Object> properties) throws IllegalAccessException, InvocationTargetException { - BeanUtilsBean.getInstance().populate(bean, properties); } @@ -486,7 +447,6 @@ public class BeanUtils { */ public static void setProperty(final Object bean, final String name, final Object value) throws IllegalAccessException, InvocationTargetException { - BeanUtilsBean.getInstance().setProperty(bean, name, value); } } diff --git a/src/main/java/org/apache/commons/beanutils/BeanUtilsBean.java b/src/main/java/org/apache/commons/beanutils/BeanUtilsBean.java index f84f3fa7..ce1f4595 100644 --- a/src/main/java/org/apache/commons/beanutils/BeanUtilsBean.java +++ b/src/main/java/org/apache/commons/beanutils/BeanUtilsBean.java @@ -240,8 +240,8 @@ public class BeanUtilsBean { * * <p>This method differs from <code>populate()</code>, which * was primarily designed for populating JavaBeans from the map of request - * parameters retrieved on an HTTP request, is that no scalar->indexed - * or indexed->scalar manipulations are performed. If the origin property + * parameters retrieved on an HTTP request, is that no scalar to indexed + * or indexed to scalar manipulations are performed. If the origin property * is indexed, the destination property must be also.</p> * * <p>If you know that no type conversions are required, the @@ -492,7 +492,8 @@ public class BeanUtilsBean { * <p><strong>Warning:</strong> if any of the bean property implementations * contain (directly or indirectly) a call to this method then * a stack overflow may result. For example: - * <code><pre> + * </p> + * <pre> * class MyBean * { * public Map getParameterMap() @@ -500,7 +501,8 @@ public class BeanUtilsBean { * BeanUtils.describe(this); * } * } - * </pre></code> + * </pre> + * <p> * will result in an infinite regression when <code>getParametersMap</code> * is called. It is recommended that such methods are given alternative * names (for example, <code>parametersMap</code>). diff --git a/src/main/java/org/apache/commons/beanutils/ConstructorUtils.java b/src/main/java/org/apache/commons/beanutils/ConstructorUtils.java index c53f6031..42743f73 100644 --- a/src/main/java/org/apache/commons/beanutils/ConstructorUtils.java +++ b/src/main/java/org/apache/commons/beanutils/ConstructorUtils.java @@ -22,10 +22,9 @@ import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Modifier; /** - * <p> Utility reflection methods focussed on constructors, modelled after {@link MethodUtils}. </p> + * <p>Utility reflection methods focussed on constructors, modelled after {@link MethodUtils}.</p> * - * <h3>Known Limitations</h3> - * <h4>Accessing Public Constructors In A Default Access Superclass</h4> + * <strong>Known Limitations: Accessing Public Constructors In A Default Access Superclass</strong> * <p>There is an issue when invoking public constructors contained in a default access superclass. * Reflection locates these constructors fine and correctly assigns them as public. * However, an <code>IllegalAccessException</code> is thrown if the constructors is invoked.</p> @@ -35,7 +34,6 @@ import java.lang.reflect.Modifier; * If this call succeeds, then the method can be invoked as normal. * This call will only succeed when the application has sufficient security privilages. * If this call fails then a warning will be logged and the method may fail.</p> - * */ public class ConstructorUtils { @@ -44,7 +42,6 @@ public class ConstructorUtils { /** An empty object array */ private static final Object[] EMPTY_OBJECT_ARRAY = {}; - /** * Returns a constructor with single argument. * @param <T> the type of the constructor diff --git a/src/main/java/org/apache/commons/beanutils/ContextClassLoaderLocal.java b/src/main/java/org/apache/commons/beanutils/ContextClassLoaderLocal.java index f06459cf..a1447b98 100644 --- a/src/main/java/org/apache/commons/beanutils/ContextClassLoaderLocal.java +++ b/src/main/java/org/apache/commons/beanutils/ContextClassLoaderLocal.java @@ -62,8 +62,6 @@ import java.util.WeakHashMap; * buf.set("New Value"); * } * </pre> - * </p> - * * <p><strong>Note:</strong> This class takes some care to ensure that when * a component which uses this class is "undeployed" by a container the * component-specific classloader and all its associated classes (and their @@ -73,6 +71,7 @@ import java.util.WeakHashMap; * component (or its container) calls the "unset" method on this class for * each instance of this class when the component is undeployed. The problem * occurs if: + * </p> * <ul> * <li>the class containing a static instance of this class was loaded via * a shared classloader, and</li> @@ -80,6 +79,7 @@ import java.util.WeakHashMap; * via the component-specific classloader (or any of the objects it refers * to were loaded via that classloader).</li> * </ul> + * <p> * The result is that the map managed by this object still contains a strong * reference to the stored object, which contains a strong reference to the * classloader that loaded it, meaning that although the container has diff --git a/src/main/java/org/apache/commons/beanutils/ConvertUtilsBean.java b/src/main/java/org/apache/commons/beanutils/ConvertUtilsBean.java index 8ed34ff4..d41b96a9 100644 --- a/src/main/java/org/apache/commons/beanutils/ConvertUtilsBean.java +++ b/src/main/java/org/apache/commons/beanutils/ConvertUtilsBean.java @@ -230,7 +230,7 @@ public class ConvertUtilsBean { * is an array, the first element (converted to a String) will be * returned. The registered {@link Converter} for the * <code>java.lang.String</code> class will be used, which allows - * applications to customize Object->String conversions (the default + * applications to customize Object to String conversions (the default * implementation simply uses toString()). * * @param value Value to be converted (may be null) diff --git a/src/main/java/org/apache/commons/beanutils/DynaBean.java b/src/main/java/org/apache/commons/beanutils/DynaBean.java index b7ea413c..e0df8398 100644 --- a/src/main/java/org/apache/commons/beanutils/DynaBean.java +++ b/src/main/java/org/apache/commons/beanutils/DynaBean.java @@ -27,17 +27,15 @@ package org.apache.commons.beanutils; * purpose of retrieving and setting property values.</p> * */ - public interface DynaBean { - /** * Does the specified mapped property contain a value for the specified * key value? * * @param name Name of the property to check * @param key Name of the key to check - * @return <code>true<code> if the mapped property contains a value for + * @return <code>true</code> if the mapped property contains a value for * the specified key, otherwise <code>false</code> * * @throws IllegalArgumentException if there is no property @@ -45,7 +43,6 @@ public interface DynaBean { */ boolean contains(String name, String key); - /** * Return the value of a simple property with the specified name. * @@ -56,7 +53,6 @@ public interface DynaBean { */ Object get(String name); - /** * Return the value of an indexed property with the specified name. * @@ -74,7 +70,6 @@ public interface DynaBean { */ Object get(String name, int index); - /** * Return the value of a mapped property with the specified name, * or <code>null</code> if there is no value for the specified key. @@ -89,7 +84,6 @@ public interface DynaBean { */ Object get(String name, String key); - /** * Return the <code>DynaClass</code> instance that describes the set of * properties available for this DynaBean. @@ -98,7 +92,6 @@ public interface DynaBean { */ DynaClass getDynaClass(); - /** * Remove any existing value for the specified key on the * specified mapped property. @@ -111,7 +104,6 @@ public interface DynaBean { */ void remove(String name, String key); - /** * Set the value of an indexed property with the specified name. * @@ -129,7 +121,6 @@ public interface DynaBean { */ void set(String name, int index, Object value); - /** * Set the value of a simple property with the specified name. * @@ -144,7 +135,6 @@ public interface DynaBean { */ void set(String name, Object value); - /** * Set the value of a mapped property with the specified name. * @@ -160,5 +150,4 @@ public interface DynaBean { */ void set(String name, String key, Object value); - } diff --git a/src/main/java/org/apache/commons/beanutils/DynaBeanMapDecorator.java b/src/main/java/org/apache/commons/beanutils/DynaBeanMapDecorator.java index ab6281d5..1ea53fdd 100644 --- a/src/main/java/org/apache/commons/beanutils/DynaBeanMapDecorator.java +++ b/src/main/java/org/apache/commons/beanutils/DynaBeanMapDecorator.java @@ -27,33 +27,32 @@ package org.apache.commons.beanutils; * <p>This can be achieved either by wrapping the {@link DynaBean} prior to * providing it to the technolody to process or by providing a <code>Map</code> * accessor method on the DynaBean implementation: - * <pre><code> + * </p> + * <pre> * public Map getMap() { * return new DynaBeanMapDecorator(this); - * }</code></pre> - * </ul> - * </p> + * }</pre> * * <p>This, for example, could be used in JSTL in the following way to access * a DynaBean's <code>fooProperty</code>: - * <ul><li><code>${myDynaBean.<strong>map</strong>.fooProperty}</code></li></ul> * </p> + * <code>${myDynaBean.<strong>map</strong>.fooProperty}</code> * - * <h3>Usage</h3> + * <strong>Usage</strong> * * <p>To decorate a {@link DynaBean} simply instantiate this class with the * target {@link DynaBean}:</p> * - * <ul><li><code>Map fooMap = new DynaBeanMapDecorator(fooDynaBean);</code></li></ul> + * <code>Map fooMap = new DynaBeanMapDecorator(fooDynaBean);</code> * * <p>The above example creates a <strong><em>read only</em></strong> <code>Map</code>. * To create a <code>Map</code> which can be modified, construct a * <code>DynaBeanMapDecorator</code> with the <strong><em>read only</em></strong> * attribute set to <code>false</code>:</p> * - * <ul><li><code>Map fooMap = new DynaBeanMapDecorator(fooDynaBean, false);</code></li></ul> + * <code>Map fooMap = new DynaBeanMapDecorator(fooDynaBean, false);</code> * - * <h3>Limitations</h3> + * <strong>Limitations</strong> * <p>In this implementation the <code>entrySet()</code>, <code>keySet()</code> * and <code>values()</code> methods create an <strong><em>unmodifiable</em></strong> * <code>Set</code> and it does not support the Map's <code>clear()</code> diff --git a/src/main/java/org/apache/commons/beanutils/DynaBeanPropertyMapDecorator.java b/src/main/java/org/apache/commons/beanutils/DynaBeanPropertyMapDecorator.java index 13833194..3330511d 100644 --- a/src/main/java/org/apache/commons/beanutils/DynaBeanPropertyMapDecorator.java +++ b/src/main/java/org/apache/commons/beanutils/DynaBeanPropertyMapDecorator.java @@ -26,19 +26,18 @@ package org.apache.commons.beanutils; * <p>This can be achieved either by wrapping the {@link DynaBean} prior to * providing it to the technology to process or by providing a <code>Map</code> * accessor method on the DynaBean implementation: - * <pre><code> + * </p> + * <pre> * public Map<String, Object> getMap() { * return new DynaBeanPropertyMapDecorator(this); - * }</code></pre> - * </ul> - * </p> + * }</pre> * * <p>This, for example, could be used in JSTL in the following way to access * a DynaBean's <code>fooProperty</code>: - * <ul><li><code>${myDynaBean.<strong>map</strong>.fooProperty}</code></li></ul> * </p> + * <ul><li><code>${myDynaBean.<strong>map</strong>.fooProperty}</code></li></ul> * - * <h3>Usage</h3> + * <strong>Usage</strong> * * <p>To decorate a {@link DynaBean} simply instantiate this class with the * target {@link DynaBean}:</p> @@ -53,7 +52,7 @@ package org.apache.commons.beanutils; * <ul><li><code>Map<String, Object> fooMap = * new DynaBeanPropertyMapDecorator(fooDynaBean, false);</code></li></ul> * - * <h3>Limitations</h3> + * <strong>Limitations</strong> * <p>In this implementation the <code>entrySet()</code>, <code>keySet()</code> * and <code>values()</code> methods create an <strong><em>unmodifiable</em></strong> * <code>Set</code> and it does not support the Map's <code>clear()</code> @@ -62,6 +61,7 @@ package org.apache.commons.beanutils; * @since BeanUtils 1.9.0 */ public class DynaBeanPropertyMapDecorator extends BaseDynaBeanMapDecorator<String> { + /** * Constructs a read only Map for the specified * {@link DynaBean}. diff --git a/src/main/java/org/apache/commons/beanutils/DynaClass.java b/src/main/java/org/apache/commons/beanutils/DynaClass.java index 2df08507..80a2d999 100644 --- a/src/main/java/org/apache/commons/beanutils/DynaClass.java +++ b/src/main/java/org/apache/commons/beanutils/DynaClass.java @@ -24,10 +24,8 @@ package org.apache.commons.beanutils; * associated data types, read-only states, and write-only states.</p> * */ - public interface DynaClass { - /** * <p>Return an array of <code>ProperyDescriptors</code> for the properties * currently defined in this DynaClass. If no properties are defined, a @@ -41,7 +39,6 @@ public interface DynaClass { */ DynaProperty[] getDynaProperties(); - /** * Return a property descriptor for the specified property, if it exists; * otherwise, return <code>null</code>. @@ -53,10 +50,9 @@ public interface DynaClass { */ DynaProperty getDynaProperty(String name); - /** * Return the name of this DynaClass (analogous to the - * <code>getName()</code> method of <code>java.lang.Class</code), which + * <code>getName()</code> method of <code>java.lang.Class</code>), which * allows the same <code>DynaClass</code> implementation class to support * different dynamic classes, with different sets of properties. * @@ -64,7 +60,6 @@ public interface DynaClass { */ String getName(); - /** * Instantiate and return a new DynaBean instance, associated * with this DynaClass. @@ -76,8 +71,6 @@ public interface DynaClass { * class, an array class, a primitive type, or void; or if instantiation * fails for some other reason */ - DynaBean newInstance() - throws IllegalAccessException, InstantiationException; - + DynaBean newInstance() throws IllegalAccessException, InstantiationException; } diff --git a/src/main/java/org/apache/commons/beanutils/FluentPropertyBeanIntrospector.java b/src/main/java/org/apache/commons/beanutils/FluentPropertyBeanIntrospector.java index 7afa3c32..78363236 100644 --- a/src/main/java/org/apache/commons/beanutils/FluentPropertyBeanIntrospector.java +++ b/src/main/java/org/apache/commons/beanutils/FluentPropertyBeanIntrospector.java @@ -36,7 +36,7 @@ import org.apache.commons.logging.LogFactory; * setting a property value do not return <strong>void</strong>, but an object which can * be called for setting another property. An example of such a fluent API could * look as follows: - * + * </p> * <pre> * public class FooBuilder { * public FooBuilder setFooProperty1(String value) { @@ -50,7 +50,7 @@ import org.apache.commons.logging.LogFactory; * } * } * </pre> - * + * <p> * Per default, <code>PropertyUtils</code> does not detect methods like this * because, having a non-<strong>void</strong> return type, they violate the Java Beans * specification. @@ -76,6 +76,7 @@ import org.apache.commons.logging.LogFactory; * @since 1.9 */ public class FluentPropertyBeanIntrospector implements BeanIntrospector { + /** The default prefix for write methods. */ public static final String DEFAULT_WRITE_METHOD_PREFIX = "set"; diff --git a/src/main/java/org/apache/commons/beanutils/JDBCDynaClass.java b/src/main/java/org/apache/commons/beanutils/JDBCDynaClass.java index 7f7c3c43..7c231db1 100644 --- a/src/main/java/org/apache/commons/beanutils/JDBCDynaClass.java +++ b/src/main/java/org/apache/commons/beanutils/JDBCDynaClass.java @@ -64,7 +64,7 @@ abstract class JDBCDynaClass implements DynaClass, Serializable { protected Map<String, DynaProperty> propertiesMap = new HashMap<>(); /** - * Cross Reference for column name --> dyna property name + * Cross Reference for column name to dyna property name * (needed when lowerCase option is true) */ private Map<String, String> columnNameXref; @@ -173,7 +173,7 @@ abstract class JDBCDynaClass implements DynaClass, Serializable { /** * <p>Return the name of this DynaClass (analogous to the - * <code>getName()</code> method of <code>java.lang.Class</code), which + * <code>getName()</code> method of <code>java.lang.Class</code>), which * allows the same <code>DynaClass</code> implementation class to support * different dynamic classes, with different sets of properties.</p> */ diff --git a/src/main/java/org/apache/commons/beanutils/LazyDynaBean.java b/src/main/java/org/apache/commons/beanutils/LazyDynaBean.java index 9485b3af..d0b469d9 100644 --- a/src/main/java/org/apache/commons/beanutils/LazyDynaBean.java +++ b/src/main/java/org/apache/commons/beanutils/LazyDynaBean.java @@ -53,8 +53,9 @@ import org.apache.commons.logging.LogFactory; * <p>The <code>LazyDynaBean</code> will automatically add a property to the <code>DynaClass</code> * if it doesn't exist when the <code>set(name, value)</code> method is called.</p> * - * <code>DynaBean myBean = new LazyDynaBean();</code></br> - * <code>myBean.set("myProperty", "myValue");</code></br> + * <pre> + * DynaBean myBean = new LazyDynaBean(); + * myBean.set("myProperty", "myValue");</pre> * * <p><strong><u>Setting Indexed Properties</u></strong></p> * <p>If the property <strong>doesn't</strong> exist, the <code>LazyDynaBean</code> will automatically add @@ -66,9 +67,10 @@ import org.apache.commons.logging.LogFactory; * this can be easily changed by overriding the <code>defaultIndexedProperty(name)</code> * method.</p> * - * <code>DynaBean myBean = new LazyDynaBean();</code></br> - * <code>myBean.set("myIndexedProperty", 0, "myValue1");</code></br> - * <code>myBean.set("myIndexedProperty", 1, "myValue2");</code></br> + * <pre> + * DynaBean myBean = new LazyDynaBean() + * myBean.set("myIndexedProperty", 0, "myValue1"); + * myBean.set("myIndexedProperty", 1, "myValue2");</pre> * * <p>If the indexed property <strong>does</strong> exist in the <code>DynaClass</code> but is set to * <code>null</code> in the <code>LazyDynaBean</code>, then it will instantiate a @@ -76,11 +78,11 @@ import org.apache.commons.logging.LogFactory; * in the <code>DynaClass</code> and automatically <em>grow</em> the <code>List</code> * or <code>Array</code> so that it is big enough to accommodate the index being set.</p> * - * <code>DynaBean myBean = new LazyDynaBean();</code></br> - * <code>MutableDynaClass myClass = (MutableDynaClass)myBean.getDynaClass();</code></br> - * <code>myClass.add("myIndexedProperty", int[].class);</code></br> - * <code>myBean.set("myIndexedProperty", 0, new Integer(10));</code></br> - * <code>myBean.set("myIndexedProperty", 1, new Integer(20));</code></br> + * <pre>DynaBean myBean = new LazyDynaBean(); + * MutableDynaClass myClass = (MutableDynaClass)myBean.getDynaClass(); + * myClass.add("myIndexedProperty", int[].class); + * myBean.set("myIndexedProperty", 0, new Integer(10)); + * myBean.set("myIndexedProperty", 1, new Integer(20));</pre> * * <p><strong><u>Setting Mapped Properties</u></strong></p> * <p>If the property <strong>doesn't</strong> exist, the <code>LazyDynaBean</code> will automatically add @@ -90,17 +92,19 @@ import org.apache.commons.logging.LogFactory; * mapped property that LazyDynaBean uses but this can be easily changed by overriding * the <code>defaultMappedProperty(name)</code> method.</p> * - * <code>DynaBean myBean = new LazyDynaBean();</code></br> - * <code>myBean.set("myMappedProperty", "myKey", "myValue");</code></br> + * <pre> + * DynaBean myBean = new LazyDynaBean(); + * myBean.set("myMappedProperty", "myKey", "myValue");</pre> * * <p>If the mapped property <strong>does</strong> exist in the <code>DynaClass</code> but is set to * <code>null</code> in the <code>LazyDynaBean</code>, then it will instantiate a * new <code>Map</code> as specified by the property's type in the <code>DynaClass</code>.</p> * - * <code>DynaBean myBean = new LazyDynaBean();</code></br> - * <code>MutableDynaClass myClass = (MutableDynaClass)myBean.getDynaClass();</code></br> - * <code>myClass.add("myMappedProperty", TreeMap.class);</code></br> - * <code>myBean.set("myMappedProperty", "myKey", "myValue");</code></br> + * <pre> + * DynaBean myBean = new LazyDynaBean(); + * MutableDynaClass myClass = (MutableDynaClass)myBean.getDynaClass(); + * myClass.add("myMappedProperty", TreeMap.class); + * myBean.set("myMappedProperty", "myKey", "myValue");</pre> * * <p><strong><u><em>Restricted</em> DynaClass</u></strong></p> * <p><code>MutableDynaClass</code> have a facility to <em>restrict</em> the <code>DynaClass</code> @@ -601,9 +605,10 @@ protected static final BigInteger BigInteger_ZERO = new BigInteger("0"); /** * Return a Map representation of this DynaBean. - * </p> + * <p> * This, for example, could be used in JSTL in the following way to access * a DynaBean's <code>fooProperty</code>: + * </p> * <ul><li><code>${myDynaBean.<strong>map</strong>.fooProperty}</code></li></ul> * * @return a Map representation of this DynaBean @@ -617,7 +622,8 @@ protected static final BigInteger BigInteger_ZERO = new BigInteger("0"); } /** - * Grow the size of an indexed property + * Grow the size of an indexed property. + * * @param name The name of the property * @param indexedProperty The current property value * @param index The indexed value to grow the property to (i.e. one less than diff --git a/src/main/java/org/apache/commons/beanutils/LazyDynaList.java b/src/main/java/org/apache/commons/beanutils/LazyDynaList.java index 32ac2e4a..8567b48e 100644 --- a/src/main/java/org/apache/commons/beanutils/LazyDynaList.java +++ b/src/main/java/org/apache/commons/beanutils/LazyDynaList.java @@ -37,12 +37,12 @@ import java.util.Map; * * <p>All elements added to the List are stored as <code>DynaBean</code>'s:</p> * <ul> - * <li><code>java.util.Map</code> elements are "wrapped" in a <code>LazyDynaMap</code>.</i> - * <li>POJO Bean elements are "wrapped" in a <code>WrapDynaBean.</code></i> - * <li><code>DynaBean</code>'s are stored un-changed.</i> + * <li><code>java.util.Map</code> elements are "wrapped" in a <code>LazyDynaMap</code>.</li> + * <li>POJO Bean elements are "wrapped" in a <code>WrapDynaBean.</code></li> + * <li><code>DynaBean</code>'s are stored un-changed.</li> * </ul> * - * <h4><code>toArray()</code></h4> + * <h3><code>toArray()</code></h3> * <p>The <code>toArray()</code> method returns an array of the * elements of the appropriate type. If the <code>LazyDynaList</code> * is populated with <code>java.util.Map</code> objects a @@ -52,7 +52,7 @@ import java.util.Map; * array is returned. * </p> * - * <h4><code>toDynaBeanArray()</code></h4> + * <h3><code>toDynaBeanArray()</code></h3> * <p>The <code>toDynaBeanArray()</code> method returns a * <code>DynaBean[]</code> array of the elements in the List. * </p> @@ -540,6 +540,7 @@ public class LazyDynaList extends ArrayList<Object> { * "wrapped" DynaBeans then an Object[] of the most * suitable type will be created.</li> * <li>...otherwise a DynaBean[] will be created.</li> + * </ul> * * @return An Array of the elements in this List. */ diff --git a/src/main/java/org/apache/commons/beanutils/MethodUtils.java b/src/main/java/org/apache/commons/beanutils/MethodUtils.java index 0859cc4d..f6ea9ced 100644 --- a/src/main/java/org/apache/commons/beanutils/MethodUtils.java +++ b/src/main/java/org/apache/commons/beanutils/MethodUtils.java @@ -32,10 +32,9 @@ import org.apache.commons.logging.LogFactory; /** - * <p> Utility reflection methods focused on methods in general rather than properties in particular. </p> + * <p>Utility reflection methods focused on methods in general rather than properties in particular.</p> * - * <h3>Known Limitations</h3> - * <h4>Accessing Public Methods In A Default Access Superclass</h4> + * <strong>Known Limitations: Accessing Public Methods In A Default Access Superclass</strong> * <p>There is an issue when invoking public methods contained in a default access superclass. * Reflection locates these methods fine and correctly assigns them as public. * However, an <code>IllegalAccessException</code> is thrown if the method is invoked.</p> @@ -47,10 +46,8 @@ import org.apache.commons.logging.LogFactory; * If this call fails then a warning will be logged and the method may fail.</p> * */ - public class MethodUtils { - /** * Represents the key to looking up a Method by reflection. */ @@ -137,6 +134,7 @@ public class MethodUtils { * a container, this will affect all webapps. However making this * configurable per webapp would mean having a map keyed by context classloader * which may introduce memory-leak problems. + * </p> */ private static boolean CACHE_METHODS = true; /** An empty class array */ @@ -147,7 +145,7 @@ public class MethodUtils { /** - * Stores a cache of MethodDescriptor -> Method in a WeakHashMap. + * Stores a cache of MethodDescriptor to Method in a WeakHashMap. * <p> * The keys into this map only ever exist as temporary variables within * methods of this class, and are never exposed to users of this class. @@ -158,6 +156,7 @@ public class MethodUtils { * this problem is doubtful; something like the commons-collections * LRUMap may be more appropriate (though of course selecting an * appropriate size is an issue). + * </p> * <p> * This static variable is safe even when this code is deployed via a * shared classloader because it is keyed via a MethodDescriptor object @@ -165,6 +164,7 @@ public class MethodUtils { * the MethodDescriptor.equals method. So two components that load the same * class via different classloaders will generate non-equal MethodDescriptor * objects and hence end up with different entries in the map. + * </p> */ private static final Map<MethodDescriptor, Reference<Method>> cache = Collections .synchronizedMap(new WeakHashMap<MethodDescriptor, Reference<Method>>()); @@ -439,18 +439,18 @@ public class MethodUtils { * Compatible parameters mean that every method parameter is assignable from * the given parameters. * In other words, it finds a method with the given name - * that will take the parameters given.<p> - * + * that will take the parameters given. + * </p> * <p>This method is slightly undeterministic since it loops * through methods names and return the first matching method.</p> - * * <p>This method is used by * {@link * #invokeMethod(Object object,String methodName,Object [] args,Class[] parameterTypes)}. - * + * </p> * <p>This method can match primitive parameter by passing in wrapper classes. * For example, a <code>Boolean</code> will match a primitive <code>boolean</code> * parameter. + * </p> * * @param clazz find method in this class * @param methodName find method with this name diff --git a/src/main/java/org/apache/commons/beanutils/ResultSetIterator.java b/src/main/java/org/apache/commons/beanutils/ResultSetIterator.java index 66c61ef6..96ab40ce 100644 --- a/src/main/java/org/apache/commons/beanutils/ResultSetIterator.java +++ b/src/main/java/org/apache/commons/beanutils/ResultSetIterator.java @@ -15,15 +15,12 @@ * limitations under the License. */ - package org.apache.commons.beanutils; - import java.sql.SQLException; import java.util.Iterator; import java.util.NoSuchElementException; - /** * <p>Implements {@link Iterator} returned by the * <code>iterator()</code> method of {@link ResultSetDynaClass}. Each @@ -31,35 +28,25 @@ import java.util.NoSuchElementException; * represents a single row from the result set being wrapped.</p> * */ - public class ResultSetIterator implements DynaBean, Iterator<DynaBean> { - - - /** * <p>Flag indicating whether the result set is currently positioned at a * row for which we have not yet returned an element in the iteration.</p> */ protected boolean current = false; - - - - /** * <p>The {@link ResultSetDynaClass} we are associated with.</p> */ protected ResultSetDynaClass dynaClass = null; - /** * <p>Flag indicating whether the result set has indicated that there are * no further rows.</p> */ protected boolean eof = false; - /** * <p>Construct an <code>Iterator</code> for the result set being wrapped * by the specified {@link ResultSetDynaClass}.</p> @@ -68,14 +55,9 @@ public class ResultSetIterator implements DynaBean, Iterator<DynaBean> { * result set we will iterate over */ ResultSetIterator(final ResultSetDynaClass dynaClass) { - this.dynaClass = dynaClass; - } - - - /** * <p>Advance the result set to the next row, if there is not a current * row (and if we are not already at eof).</p> @@ -83,7 +65,6 @@ public class ResultSetIterator implements DynaBean, Iterator<DynaBean> { * @throws SQLException if the result set throws an exception */ protected void advance() throws SQLException { - if (!current && !eof) { if (dynaClass.getResultSet().next()) { current = true; @@ -93,17 +74,15 @@ public class ResultSetIterator implements DynaBean, Iterator<DynaBean> { eof = true; } } - } - /** * Does the specified mapped property contain a value for the specified * key value? * * @param name Name of the property to check * @param key Name of the key to check - * @return <code>true<code> if the mapped property contains a value for + * @return <code>true</code> if the mapped property contains a value for * the specified key, otherwise <code>false</code> * * @throws IllegalArgumentException if there is no property @@ -111,13 +90,10 @@ public class ResultSetIterator implements DynaBean, Iterator<DynaBean> { */ @Override public boolean contains(final String name, final String key) { - throw new UnsupportedOperationException ("FIXME - mapped properties not currently supported"); - } - /** * Return the value of a simple property with the specified name. * @@ -128,7 +104,6 @@ public class ResultSetIterator implements DynaBean, Iterator<DynaBean> { */ @Override public Object get(final String name) { - if (dynaClass.getDynaProperty(name) == null) { throw new IllegalArgumentException(name); } @@ -138,10 +113,8 @@ public class ResultSetIterator implements DynaBean, Iterator<DynaBean> { throw new RuntimeException ("get(" + name + "): SQLException: " + e); } - } - /** * Return the value of an indexed property with the specified name. * @@ -159,10 +132,8 @@ public class ResultSetIterator implements DynaBean, Iterator<DynaBean> { */ @Override public Object get(final String name, final int index) { - throw new UnsupportedOperationException ("FIXME - indexed properties not currently supported"); - } @@ -180,13 +151,10 @@ public class ResultSetIterator implements DynaBean, Iterator<DynaBean> { */ @Override public Object get(final String name, final String key) { - throw new UnsupportedOperationException ("FIXME - mapped properties not currently supported"); - } - /** * Return the <code>DynaClass</code> instance that describes the set of * properties available for this DynaBean. @@ -195,12 +163,9 @@ public class ResultSetIterator implements DynaBean, Iterator<DynaBean> { */ @Override public DynaClass getDynaClass() { - return this.dynaClass; - } - /** * <p>Return <code>true</code> if the iteration has more elements.</p> * @@ -209,17 +174,14 @@ public class ResultSetIterator implements DynaBean, Iterator<DynaBean> { */ @Override public boolean hasNext() { - try { advance(); return !eof; } catch (final SQLException e) { throw new RuntimeException("hasNext(): SQLException: " + e); } - } - /** * <p>Return the next element in the iteration.</p> * @@ -227,7 +189,6 @@ public class ResultSetIterator implements DynaBean, Iterator<DynaBean> { */ @Override public DynaBean next() { - try { advance(); if (eof) { @@ -241,21 +202,15 @@ public class ResultSetIterator implements DynaBean, Iterator<DynaBean> { } - /** * <p>Remove the current element from the iteration. This method is * not supported.</p> */ @Override public void remove() { - throw new UnsupportedOperationException("remove()"); - } - - - /** * Remove any existing value for the specified key on the * specified mapped property. @@ -268,13 +223,10 @@ public class ResultSetIterator implements DynaBean, Iterator<DynaBean> { */ @Override public void remove(final String name, final String key) { - throw new UnsupportedOperationException ("FIXME - mapped operations not currently supported"); - } - /** * Set the value of an indexed property with the specified name. * @@ -292,10 +244,8 @@ public class ResultSetIterator implements DynaBean, Iterator<DynaBean> { */ @Override public void set(final String name, final int index, final Object value) { - throw new UnsupportedOperationException ("FIXME - indexed properties not currently supported"); - } @@ -313,7 +263,6 @@ public class ResultSetIterator implements DynaBean, Iterator<DynaBean> { */ @Override public void set(final String name, final Object value) { - if (dynaClass.getDynaProperty(name) == null) { throw new IllegalArgumentException(name); } @@ -323,12 +272,8 @@ public class ResultSetIterator implements DynaBean, Iterator<DynaBean> { throw new RuntimeException ("set(" + name + "): SQLException: " + e); } - } - - - /** * Set the value of a mapped property with the specified name. * @@ -344,11 +289,8 @@ public class ResultSetIterator implements DynaBean, Iterator<DynaBean> { */ @Override public void set(final String name, final String key, final Object value) { - throw new UnsupportedOperationException ("FIXME - mapped properties not currently supported"); - } - } diff --git a/src/main/java/org/apache/commons/beanutils/WrapDynaBean.java b/src/main/java/org/apache/commons/beanutils/WrapDynaBean.java index aaa8823e..f811a8f5 100644 --- a/src/main/java/org/apache/commons/beanutils/WrapDynaBean.java +++ b/src/main/java/org/apache/commons/beanutils/WrapDynaBean.java @@ -31,26 +31,21 @@ import java.lang.reflect.InvocationTargetException; * (This makes it different from the typical use cases for other <code>DynaBean</code>'s.) * For example: * </p> - * <code><pre> + * <pre> * Object aJavaBean = ...; * ... * DynaBean db = new WrapDynaBean(aJavaBean); * ... - * </pre></code> + * </pre> * * <p><strong>IMPLEMENTATION NOTE</strong> - This implementation does not * support the <code>contains()</code> and <code>remove()</code> methods.</p> * */ - public class WrapDynaBean implements DynaBean, Serializable { - - - private static final long serialVersionUID = 1L; - /** * The <code>DynaClass</code> "base class" that this DynaBean * is associated with. @@ -62,8 +57,6 @@ public class WrapDynaBean implements DynaBean, Serializable { */ protected Object instance = null; - - /** * Construct a new <code>DynaBean</code> associated with the specified * JavaBean instance. @@ -71,12 +64,9 @@ public class WrapDynaBean implements DynaBean, Serializable { * @param instance JavaBean instance to be wrapped */ public WrapDynaBean(final Object instance) { - this(instance, null); - } - /** * Creates a new instance of {@code WrapDynaBean}, associates it with the specified * JavaBean instance, and initializes the bean's {@code DynaClass}. Using this @@ -89,22 +79,17 @@ public class WrapDynaBean implements DynaBean, Serializable { * @since 1.9 */ public WrapDynaBean(final Object instance, final WrapDynaClass cls) { - this.instance = instance; this.dynaClass = cls != null ? cls : (WrapDynaClass) getDynaClass(); - } - - - /** * Does the specified mapped property contain a value for the specified * key value? * * @param name Name of the property to check * @param key Name of the key to check - * @return <code>true<code> if the mapped property contains a value for + * @return <code>true</code> if the mapped property contains a value for * the specified key, otherwise <code>false</code> * * @throws IllegalArgumentException if there is no property @@ -112,13 +97,10 @@ public class WrapDynaBean implements DynaBean, Serializable { */ @Override public boolean contains(final String name, final String key) { - throw new UnsupportedOperationException ("WrapDynaBean does not support contains()"); - } - /** * Return the value of a simple property with the specified name. * @@ -129,7 +111,6 @@ public class WrapDynaBean implements DynaBean, Serializable { */ @Override public Object get(final String name) { - Object value = null; try { value = getPropertyUtils().getSimpleProperty(instance, name); @@ -144,10 +125,8 @@ public class WrapDynaBean implements DynaBean, Serializable { "', exception - " + t); } return value; - } - /** * Return the value of an indexed property with the specified name. * @@ -185,7 +164,6 @@ public class WrapDynaBean implements DynaBean, Serializable { } - /** * Return the value of a mapped property with the specified name, * or <code>null</code> if there is no value for the specified key. @@ -218,7 +196,6 @@ public class WrapDynaBean implements DynaBean, Serializable { } - /** * Return the <code>DynaClass</code> instance that describes the set of * properties available for this DynaBean. @@ -235,7 +212,6 @@ public class WrapDynaBean implements DynaBean, Serializable { } - /** * Return the property descriptor for the specified property name. * @@ -255,7 +231,6 @@ public class WrapDynaBean implements DynaBean, Serializable { } - /** * Gets the bean instance wrapped by this DynaBean. * For most common use cases, @@ -270,7 +245,6 @@ public class WrapDynaBean implements DynaBean, Serializable { return instance; } - /** * Returns the {@code PropertyUtilsBean} instance to be used for accessing properties. * If available, this object is obtained from the associated {@code WrapDynaClass}. @@ -287,7 +261,6 @@ public class WrapDynaBean implements DynaBean, Serializable { } - /** * Remove any existing value for the specified key on the * specified mapped property. @@ -300,11 +273,8 @@ public class WrapDynaBean implements DynaBean, Serializable { */ @Override public void remove(final String name, final String key) { - - throw new UnsupportedOperationException ("WrapDynaBean does not support remove()"); - } /** @@ -324,7 +294,6 @@ public class WrapDynaBean implements DynaBean, Serializable { */ @Override public void set(final String name, final int index, final Object value) { - try { getPropertyUtils().setIndexedProperty(instance, name, index, value); } catch (final IndexOutOfBoundsException e) { @@ -339,12 +308,8 @@ public class WrapDynaBean implements DynaBean, Serializable { ("Error setting indexed property '" + name + "', exception - " + t); } - } - - - /** * Set the value of a simple property with the specified name. * diff --git a/src/main/java/org/apache/commons/beanutils/WrapDynaClass.java b/src/main/java/org/apache/commons/beanutils/WrapDynaClass.java index a0aaa0ec..77cd021d 100644 --- a/src/main/java/org/apache/commons/beanutils/WrapDynaClass.java +++ b/src/main/java/org/apache/commons/beanutils/WrapDynaClass.java @@ -17,7 +17,6 @@ package org.apache.commons.beanutils; - import java.beans.PropertyDescriptor; import java.lang.ref.Reference; import java.lang.ref.SoftReference; @@ -29,7 +28,6 @@ import java.util.Map; import java.util.Set; import java.util.WeakHashMap; - /** * <p>Implements <code>DynaClass</code> for DynaBeans that wrap * standard JavaBean instances.</p> @@ -39,19 +37,13 @@ import java.util.WeakHashMap; * to create new <code>WrapDynaBean</code> instances. * It's usually better to call the <code>WrapDynaBean</code> constructor directly. * For example:</p> - * <code><pre> + * <pre> * Object javaBean = ...; * DynaBean wrapper = new WrapDynaBean(javaBean); - * </pre></code> - * <p> - * + * </pre> */ - public class WrapDynaClass implements DynaClass { - - - /** * A class representing the combined key for the cache of {@code WrapDynaClass} * instances. A single key consists of a bean class and an instance of @@ -97,8 +89,6 @@ public class WrapDynaClass implements DynaClass { } } - - private static final ContextClassLoaderLocal<Map<CacheKey, WrapDynaClass>> CLASSLOADER_CACHE = new ContextClassLoaderLocal<Map<CacheKey, WrapDynaClass>>() { @Override @@ -217,9 +207,7 @@ public class WrapDynaClass implements DynaClass { * Clear our cache of WrapDynaClass instances. */ public static void clear() { - getClassesCache().clear(); - } /** @@ -230,12 +218,9 @@ public class WrapDynaClass implements DynaClass { * @return A new <em>Wrap</em> {@link DynaClass} */ public static WrapDynaClass createDynaClass(final Class<?> beanClass) { - return createDynaClass(beanClass, null); - } - /** * Create (if necessary) and return a new {@code WrapDynaClass} instance * for the specified bean class using the given {@code PropertyUtilsBean} @@ -249,7 +234,6 @@ public class WrapDynaClass implements DynaClass { * @since 1.9 */ public static WrapDynaClass createDynaClass(final Class<?> beanClass, final PropertyUtilsBean pu) { - final PropertyUtilsBean propUtils = pu != null ? pu : PropertyUtilsBean.getInstance(); final CacheKey key = new CacheKey(beanClass, propUtils); WrapDynaClass dynaClass = getClassesCache().get(key); @@ -258,10 +242,8 @@ public class WrapDynaClass implements DynaClass { getClassesCache().put(key, dynaClass); } return dynaClass; - } - /** * Returns the cache for the already created class instances. For each * combination of bean class and {@code PropertyUtilsBean} instance an @@ -272,7 +254,6 @@ public class WrapDynaClass implements DynaClass { return CLASSLOADER_CACHE.get(); } - /** * Get the wrap dyna classes cache. Note: This method only exists to * satisfy the deprecated {@code dynaClasses} hash map. @@ -285,15 +266,11 @@ public class WrapDynaClass implements DynaClass { return cache; } - /** * Name of the JavaBean class represented by this WrapDynaClass. */ private String beanClassName = null; - - - /** * Reference to the JavaBean class represented by this WrapDynaClass. */ @@ -316,8 +293,6 @@ public class WrapDynaClass implements DynaClass { */ protected PropertyDescriptor[] descriptors = null; - - /** * The set of PropertyDescriptors for this bean class, keyed by the * property name. Individual descriptor instances will be the same @@ -330,7 +305,6 @@ public class WrapDynaClass implements DynaClass { */ protected DynaProperty[] properties = null; - /** * The set of dynamic properties that are part of this DynaClass, * keyed by the property name. Individual descriptor instances will @@ -338,7 +312,6 @@ public class WrapDynaClass implements DynaClass { */ protected HashMap<String, DynaProperty> propertiesMap = new HashMap<>(); - /** * Construct a new WrapDynaClass for the specified JavaBean class. This * constructor is private; WrapDynaClass instances will be created as @@ -353,10 +326,8 @@ public class WrapDynaClass implements DynaClass { this.beanClassName = beanClass.getName(); propertyUtilsBean = propUtils; introspect(); - } - /** * Return the class of the underlying wrapped bean. * @@ -367,9 +338,6 @@ public class WrapDynaClass implements DynaClass { return beanClassRef.get(); } - - - /** * <p>Return an array of <code>ProperyDescriptors</code> for the properties * currently defined in this DynaClass. If no properties are defined, a @@ -383,14 +351,9 @@ public class WrapDynaClass implements DynaClass { */ @Override public DynaProperty[] getDynaProperties() { - return properties; - } - - - /** * Return a property descriptor for the specified property, if it exists; * otherwise, return <code>null</code>. @@ -402,19 +365,16 @@ public class WrapDynaClass implements DynaClass { */ @Override public DynaProperty getDynaProperty(final String name) { - if (name == null) { throw new IllegalArgumentException ("No property name specified"); } return propertiesMap.get(name); - } - /** * Return the name of this DynaClass (analogous to the - * <code>getName()</code> method of <code>java.lang.Class</code), which + * <code>getName()</code> method of <code>java.lang.Class</code>), which * allows the same <code>DynaClass</code> implementation class to support * different dynamic classes, with different sets of properties. * @@ -422,12 +382,9 @@ public class WrapDynaClass implements DynaClass { */ @Override public String getName() { - return beanClassName; - } - /** * Return the PropertyDescriptor for the specified property name, if any; * otherwise return <code>null</code>. @@ -436,9 +393,7 @@ public class WrapDynaClass implements DynaClass { * @return The descriptor for the specified property */ public PropertyDescriptor getPropertyDescriptor(final String name) { - return descriptorsMap.get(name); - } @@ -458,7 +413,6 @@ public class WrapDynaClass implements DynaClass { * Introspect our bean class to identify the supported properties. */ protected void introspect() { - // Look up the property descriptors for this bean class final Class<?> beanClass = getBeanClass(); PropertyDescriptor[] regulars = @@ -472,7 +426,6 @@ public class WrapDynaClass implements DynaClass { if (mappeds == null) { mappeds = new HashMap<>(); } - // Construct corresponding DynaProperty information properties = new DynaProperty[regulars.length + mappeds.size()]; for (int i = 0; i < regulars.length; i++) { @@ -497,7 +450,6 @@ public class WrapDynaClass implements DynaClass { properties[j]); j++; } - } /** @@ -505,15 +457,16 @@ public class WrapDynaClass implements DynaClass { * this DynaClass and return it wrapped in a new WrapDynaBean * instance. <strong>NOTE</strong> the JavaBean should have a * no argument constructor.</p> - * + * <p> * <strong>NOTE</strong> - Most common use cases should not need to use * this method. It is usually better to create new * <code>WrapDynaBean</code> instances by calling its constructor. - * For example:</p> - * <code><pre> + * For example: + * </p> + * <pre> * Object javaBean = ...; * DynaBean wrapper = new WrapDynaBean(javaBean); - * </pre></code> + * </pre> * <p> * (This method is needed for some kinds of <code>DynaBean</code> framework.) * </p> @@ -528,7 +481,6 @@ public class WrapDynaClass implements DynaClass { @Override public DynaBean newInstance() throws IllegalAccessException, InstantiationException { - return new WrapDynaBean(getBeanClass().newInstance()); } diff --git a/src/main/java/org/apache/commons/beanutils/converters/AbstractConverter.java b/src/main/java/org/apache/commons/beanutils/converters/AbstractConverter.java index de4f0908..c0199548 100644 --- a/src/main/java/org/apache/commons/beanutils/converters/AbstractConverter.java +++ b/src/main/java/org/apache/commons/beanutils/converters/AbstractConverter.java @@ -245,7 +245,7 @@ public abstract class AbstractConverter implements Converter { * specified type. * <p> * Typical implementations will provide a minimum of - * <code>String --> type</code> conversion. + * <code>String to type</code> conversion. * * @param <T> Target type of the conversion. * @param type Data type to which this value should be converted. diff --git a/src/main/java/org/apache/commons/beanutils/converters/ArrayConverter.java b/src/main/java/org/apache/commons/beanutils/converters/ArrayConverter.java index b4200c70..308d7977 100644 --- a/src/main/java/org/apache/commons/beanutils/converters/ArrayConverter.java +++ b/src/main/java/org/apache/commons/beanutils/converters/ArrayConverter.java @@ -36,8 +36,10 @@ import org.apache.commons.beanutils.Converter; * <p> * Can be configured to either return a <em>default value</em> or throw a * <code>ConversionException</code> if a conversion error occurs. + * </p> * <p> * The main features of this implementation are: + * </p> * <ul> * <li><strong>Element Conversion</strong> - delegates to a {@link Converter}, * appropriate for the type, to convert individual elements @@ -58,18 +60,18 @@ import org.apache.commons.beanutils.Converter; * <li><strong>Multi Dimensional Arrays</strong> - it is possible to convert a <code>String</code> * to a multi-dimensional arrays, by embedding {@link ArrayConverter} * within each other - see example below.</li> - * <li><strong>Default Value</strong></li> + * <li><strong>Default Value</strong> * <ul> - * <li><strong><em>No Default</strong></em> - use the + * <li><strong><em>No Default</em></strong> - use the * {@link ArrayConverter#ArrayConverter(Class, Converter)} * constructor to create a converter which throws a * {@link ConversionException} if the value is missing or * invalid.</li> - * <li><strong><em>Default values</strong></em> - use the + * <li><strong><em>Default values</em></strong> - use the * {@link ArrayConverter#ArrayConverter(Class, Converter, int)} * constructor to create a converter which returns a <i>default * value</i>. The <em>defaultSize</em> parameter controls the - * <em>default value</em> in the following way:</li> + * <em>default value</em> in the following way: * <ul> * <li><em>defaultSize < 0</em> - default is <code>null</code></li> * <li><em>defaultSize = 0</em> - default is an array of length zero</li> @@ -77,10 +79,12 @@ import org.apache.commons.beanutils.Converter; * length specified by <code>defaultSize</code> (N.B. elements * in the array will be <code>null</code>)</li> * </ul> + * </li> * </ul> + * </li> * </ul> * - * <h3>Parsing Delimited Lists</h3> + * <h2>Parsing Delimited Lists</h2> * This implementation can convert a delimited list in <code>String</code> format * into an array of the appropriate type. By default, it uses a comma as the delimiter * but the following methods can be used to configure parsing: @@ -92,14 +96,14 @@ import org.apache.commons.beanutils.Converter; * valid token characters. * </ul> * - * <h3>Multi Dimensional Arrays</h3> + * <h2>Multi Dimensional Arrays</h2> * It is possible to convert a <code>String</code> to mulit-dimensional arrays by using * {@link ArrayConverter} as the element {@link Converter} * within another {@link ArrayConverter}. * <p> * For example, the following code demonstrates how to construct a {@link Converter} * to convert a delimited <code>String</code> into a two dimensional integer array: - * <p> + * </p> * <pre> * // Construct an Integer Converter * IntegerConverter integerConverter = new IntegerConverter(); @@ -195,7 +199,6 @@ public class ArrayConverter extends AbstractConverter { /** * Converts non-array values to a Collection prior * to being converted either to an array or a String. - * </p> * <ul> * <li>{@link Collection} values are returned unchanged</li> * <li>{@link Number}, {@link Boolean} and {@link java.util.Date} @@ -203,11 +206,12 @@ public class ArrayConverter extends AbstractConverter { * <li>All other types are converted to a String and parsed * as a delimited list.</li> * </ul> - * + * <p> * <strong>N.B.</strong> The method is called by both the * {@link ArrayConverter#convertToType(Class, Object)} and * {@link ArrayConverter#convertToString(Object)} methods for * <em>non-array</em> types. + * </p> * * @param type The type to convert the value to * @param value value to be converted diff --git a/src/main/java/org/apache/commons/beanutils/converters/BooleanArrayConverter.java b/src/main/java/org/apache/commons/beanutils/converters/BooleanArrayConverter.java index b537e9ba..a60ed565 100644 --- a/src/main/java/org/apache/commons/beanutils/converters/BooleanArrayConverter.java +++ b/src/main/java/org/apache/commons/beanutils/converters/BooleanArrayConverter.java @@ -55,7 +55,7 @@ public final class BooleanArrayConverter extends AbstractArrayConverter { /** * The converter that all instances of this class will use to - * do individual string->boolean conversions, unless overridden + * do individual string to boolean conversions, unless overridden * in the constructor. */ private static final BooleanConverter DEFAULT_CONVERTER diff --git a/src/main/java/org/apache/commons/beanutils/converters/BooleanConverter.java b/src/main/java/org/apache/commons/beanutils/converters/BooleanConverter.java index 1c3b288e..f52aeaa0 100644 --- a/src/main/java/org/apache/commons/beanutils/converters/BooleanConverter.java +++ b/src/main/java/org/apache/commons/beanutils/converters/BooleanConverter.java @@ -24,11 +24,13 @@ package org.apache.commons.beanutils.converters; * <p> * Can be configured to either return a <em>default value</em> or throw a * <code>ConversionException</code> if a conversion error occurs. + * </p> * <p> * By default any object whose string representation is one of the values * {"yes", "y", "true", "on", "1"} is converted to Boolean.TRUE, and * string representations {"no", "n", "false", "off", "0"} are converted * to Boolean.FALSE. The recognized true/false strings can be changed by: + * </p> * <pre> * String[] trueStrings = {"oui", "o", "1"}; * String[] falseStrings = {"non", "n", "0"}; @@ -36,23 +38,20 @@ package org.apache.commons.beanutils.converters; * ConvertUtils.register(bc, Boolean.class); * ConvertUtils.register(bc, Boolean.TYPE); * </pre> + * <p> * In addition, it is recommended that the BooleanArrayConverter also be * modified to recognise the same set of values: + * </p> * <pre> * Converter bac = new BooleanArrayConverter(bc, BooleanArrayConverter.NO_DEFAULT); * ConvertUtils.register(bac, bac.MODEL); * </pre> - * </p> - * * <p>Case is ignored when converting values to true or false.</p> * * @since 1.3 */ public final class BooleanConverter extends AbstractConverter { - - - /** * This is a special reference that can be passed as the "default object" * to the constructor to indicate that no default is desired. Note that @@ -63,7 +62,6 @@ public final class BooleanConverter extends AbstractConverter { @Deprecated public static final Object NO_DEFAULT = new Object(); - /** * This method creates a copy of the provided array, and ensures that * all the strings in the newly created array contain only lower-case @@ -90,9 +88,6 @@ public final class BooleanConverter extends AbstractConverter { */ private String[] falseStrings = {"false", "no", "n", "off", "0"}; - - - /** * Create a {@link org.apache.commons.beanutils.Converter} that will throw a * {@link org.apache.commons.beanutils.ConversionException} @@ -102,8 +97,6 @@ public final class BooleanConverter extends AbstractConverter { public BooleanConverter() { } - - /** * Create a {@link org.apache.commons.beanutils.Converter} that will return the specified default value * if a conversion error occurs, ie the string value being converted is @@ -145,7 +138,6 @@ public final class BooleanConverter extends AbstractConverter { this.falseStrings = copyStrings(falseStrings); } - /** * Create a {@link org.apache.commons.beanutils.Converter} that will return * the specified default value if a conversion error occurs. diff --git a/src/main/java/org/apache/commons/beanutils/converters/ConverterFacade.java b/src/main/java/org/apache/commons/beanutils/converters/ConverterFacade.java index 1b100ac2..248c1946 100644 --- a/src/main/java/org/apache/commons/beanutils/converters/ConverterFacade.java +++ b/src/main/java/org/apache/commons/beanutils/converters/ConverterFacade.java @@ -22,10 +22,11 @@ import org.apache.commons.beanutils.Converter; * Provides a facade for {@link Converter} implementations * preventing access to any public API in the implementation, * other than that specified by {@link Converter}. - * <p /> + * <p> * This implementation can be used to prevent registered {@link Converter} * implementations that provide configuration options from being * retrieved and modified. + * </p> * * @since 1.8.0 */ diff --git a/src/main/java/org/apache/commons/beanutils/converters/DateTimeConverter.java b/src/main/java/org/apache/commons/beanutils/converters/DateTimeConverter.java index f2e025f4..117e1ddc 100644 --- a/src/main/java/org/apache/commons/beanutils/converters/DateTimeConverter.java +++ b/src/main/java/org/apache/commons/beanutils/converters/DateTimeConverter.java @@ -32,6 +32,7 @@ import org.apache.commons.beanutils.ConversionException; * <p> * This implementation handles conversion for the following * <em>date/time</em> types. + * </p> * <ul> * <li><code>java.util.Date</code></li> * <li><code>java.util.Calendar</code></li> @@ -40,39 +41,43 @@ import org.apache.commons.beanutils.ConversionException; * <li><code>java.sql.Timestamp</code></li> * </ul> * - * <h3>String Conversions (to and from)</h3> + * <h2>String Conversions (to and from)</h2> * This class provides a number of ways in which date/time * conversions to/from Strings can be achieved: * <ul> - * <li>Using the SHORT date format for the default Locale, configure using:</li> + * <li>Using the SHORT date format for the default Locale, configure using: * <ul> * <li><code>setUseLocaleFormat(true)</code></li> * </ul> - * <li>Using the SHORT date format for a specified Locale, configure using:</li> + * </li> + * <li>Using the SHORT date format for a specified Locale, configure using: * <ul> * <li><code>setLocale(Locale)</code></li> * </ul> - * <li>Using the specified date pattern(s) for the default Locale, configure using:</li> + * </li> + * <li>Using the specified date pattern(s) for the default Locale, configure using: * <ul> * <li>Either <code>setPattern(String)</code> or * <code>setPatterns(String[])</code></li> * </ul> - * <li>Using the specified date pattern(s) for a specified Locale, configure using:</li> + * </li> + * <li>Using the specified date pattern(s) for a specified Locale, configure using: * <ul> * <li><code>setPattern(String)</code> or * <code>setPatterns(String[]) and...</code></li> * <li><code>setLocale(Locale)</code></li> * </ul> + * </li> * <li>If none of the above are configured the * <code>toDate(String)</code> method is used to convert * from String to Date and the Dates's * <code>toString()</code> method used to convert from * Date to String.</li> * </ul> - * * <p> * The <strong>Time Zone</strong> to use with the date format can be specified * using the <code>setTimeZone()</code> method. + * </p> * * @since 1.8.0 */ @@ -246,7 +251,7 @@ public abstract class DateTimeConverter extends AbstractConverter { } /** - * Return a <code>DateFormat<code> for the Locale. + * Return a <code>DateFormat</code> for the Locale. * @param locale The Locale to create the Format with (may be null) * @param timeZone The Time Zone create the Format with (may be null) * @return A Date Format. diff --git a/src/main/java/org/apache/commons/beanutils/converters/NumberConverter.java b/src/main/java/org/apache/commons/beanutils/converters/NumberConverter.java index 122d0e2e..b7a010ba 100644 --- a/src/main/java/org/apache/commons/beanutils/converters/NumberConverter.java +++ b/src/main/java/org/apache/commons/beanutils/converters/NumberConverter.java @@ -45,27 +45,31 @@ import org.apache.commons.beanutils.ConversionException; * <li><code>java.math.BigInteger</code></li> * </ul> * - * <h3>String Conversions (to and from)</h3> + * <h2>String Conversions (to and from)</h2> * This class provides a number of ways in which number * conversions to/from Strings can be achieved: * <ul> - * <li>Using the default format for the default Locale, configure using:</li> + * <li>Using the default format for the default Locale, configure using: * <ul> * <li><code>setUseLocaleFormat(true)</code></li> * </ul> - * <li>Using the default format for a specified Locale, configure using:</li> + * </li> + * <li>Using the default format for a specified Locale, configure using: * <ul> * <li><code>setLocale(Locale)</code></li> * </ul> - * <li>Using a specified pattern for the default Locale, configure using:</li> + * </li> + * <li>Using a specified pattern for the default Locale, configure using: * <ul> * <li><code>setPattern(String)</code></li> * </ul> - * <li>Using a specified pattern for a specified Locale, configure using:</li> + * </li> + * <li>Using a specified pattern for a specified Locale, configure using: * <ul> * <li><code>setPattern(String)</code></li> * <li><code>setLocale(Locale)</code></li> * </ul> + * </li> * <li>If none of the above are configured the * <code>toNumber(String)</code> method is used to convert * from String to Number and the Number's @@ -78,6 +82,7 @@ import org.apache.commons.beanutils.ConversionException; * pattern characters and NOT in <em>localized</em> form (see <code>java.text.DecimalFormat</code>). * For example to cater for number styles used in Germany such as <code>0.000,00</code> the pattern * is specified in the normal form <code>0,000.00</code> and the locale set to <code>Locale.GERMANY</code>. + * </p> * * @since 1.8.0 */ diff --git a/src/main/java/org/apache/commons/beanutils/converters/SqlTimeConverter.java b/src/main/java/org/apache/commons/beanutils/converters/SqlTimeConverter.java index f864efde..73385767 100644 --- a/src/main/java/org/apache/commons/beanutils/converters/SqlTimeConverter.java +++ b/src/main/java/org/apache/commons/beanutils/converters/SqlTimeConverter.java @@ -68,7 +68,7 @@ public final class SqlTimeConverter extends DateTimeConverter { } /** - * Return a <code>DateFormat<code> for the Locale. + * Return a <code>DateFormat</code> for the Locale. * @param locale TODO * @param timeZone TODO * @return The DateFormat. diff --git a/src/main/java/org/apache/commons/beanutils/converters/SqlTimestampConverter.java b/src/main/java/org/apache/commons/beanutils/converters/SqlTimestampConverter.java index 670f04d7..aa8d1dbf 100644 --- a/src/main/java/org/apache/commons/beanutils/converters/SqlTimestampConverter.java +++ b/src/main/java/org/apache/commons/beanutils/converters/SqlTimestampConverter.java @@ -68,7 +68,7 @@ public final class SqlTimestampConverter extends DateTimeConverter { } /** - * Return a <code>DateFormat<code> for the Locale. + * Return a <code>DateFormat</code> for the Locale. * @param locale TODO * @param timeZone TODO * @return The DateFormat. diff --git a/src/main/java/org/apache/commons/beanutils/converters/StringConverter.java b/src/main/java/org/apache/commons/beanutils/converters/StringConverter.java index 274a7521..e7b4d05d 100644 --- a/src/main/java/org/apache/commons/beanutils/converters/StringConverter.java +++ b/src/main/java/org/apache/commons/beanutils/converters/StringConverter.java @@ -21,8 +21,8 @@ package org.apache.commons.beanutils.converters; * implementation that converts an incoming * object into a <code>java.lang.String</code> object. * <p> - * Note that ConvertUtils really is designed to do string->object conversions, - * and offers very little support for object->string conversions. The + * Note that ConvertUtils really is designed to do string to object conversions, + * and offers very little support for object to string conversions. The * ConvertUtils/ConvertUtilsBean methods only select a converter to apply * based upon the target type being converted to, and generally assume that * the input is a string (by calling its toString method if needed). diff --git a/src/main/java/org/apache/commons/beanutils/converters/package-info.java b/src/main/java/org/apache/commons/beanutils/converters/package-info.java index 5104f7b1..a8b7bbe0 100644 --- a/src/main/java/org/apache/commons/beanutils/converters/package-info.java +++ b/src/main/java/org/apache/commons/beanutils/converters/package-info.java @@ -16,7 +16,7 @@ */ /** - * Standard implementations of the {@link Converter} interface that - * are pre-registered with {@link ConvertUtils} at startup time. + * Standard implementations of the {@link org.apache.commons.beanutils.Converter} interface that + * are pre-registered with {@link org.apache.commons.beanutils.ConvertUtils} at startup time. */ package org.apache.commons.beanutils.converters; diff --git a/src/main/java/org/apache/commons/beanutils/expression/Resolver.java b/src/main/java/org/apache/commons/beanutils/expression/Resolver.java index 5fbd7dd4..e98590a2 100644 --- a/src/main/java/org/apache/commons/beanutils/expression/Resolver.java +++ b/src/main/java/org/apache/commons/beanutils/expression/Resolver.java @@ -24,7 +24,7 @@ package org.apache.commons.beanutils.expression; * expression and resolve <em>nested</em>, <em>indexed</em> and <em>mapped</em> * property names. The following code provides an example usage * demonstrating all the methods: - * + * </p> * <pre> * // Iterate through a nested property expression * while (resolver.hasNested(name)) { @@ -54,12 +54,13 @@ package org.apache.commons.beanutils.expression; * name = resolver.remove(name); * } * </pre> - * + * <p> * In order to create an implementation, it is important to understand how * BeanUtils/PropertyUtils uses the <code>resolver</code>. The following are * the main methods that use it: + * </p> * <ul> - * <li>{@link org.apache.commons.beanutils.PropertyUtilsBean}</li> + * <li>{@link org.apache.commons.beanutils.PropertyUtilsBean} * <ul> * <li>{@link org.apache.commons.beanutils.PropertyUtilsBean#getIndexedProperty(Object, String)}</li> * <li>{@link org.apache.commons.beanutils.PropertyUtilsBean#getMappedProperty(Object, String)}</li> @@ -71,16 +72,19 @@ package org.apache.commons.beanutils.expression; * <li>{@link org.apache.commons.beanutils.PropertyUtilsBean#setNestedProperty(Object, String, Object)}</li> * <li>{@link org.apache.commons.beanutils.PropertyUtilsBean#setSimpleProperty(Object, String, Object)}</li> * </ul> - * <li>{@link org.apache.commons.beanutils.BeanUtilsBean}</li> + * </li> + * <li>{@link org.apache.commons.beanutils.BeanUtilsBean} * <ul> * <li>{@link org.apache.commons.beanutils.BeanUtilsBean#copyProperty(Object, String, Object)}</li> * <li>{@link org.apache.commons.beanutils.BeanUtilsBean#setProperty(Object, String, Object)}</li> * </ul> - * <li>{@link org.apache.commons.beanutils.locale.LocaleBeanUtilsBean}</li> + * </li> + * <li>{@link org.apache.commons.beanutils.locale.LocaleBeanUtilsBean} * <ul> * <li>{@link org.apache.commons.beanutils.locale.LocaleBeanUtilsBean#setProperty(Object, * String, Object, String)}</li> * </ul> + * </li> * </ul> * * @see org.apache.commons.beanutils.PropertyUtilsBean#setResolver(Resolver) diff --git a/src/main/java/org/apache/commons/beanutils/locale/converters/package-info.java b/src/main/java/org/apache/commons/beanutils/locale/converters/package-info.java index d004db4d..f9fb7f80 100644 --- a/src/main/java/org/apache/commons/beanutils/locale/converters/package-info.java +++ b/src/main/java/org/apache/commons/beanutils/locale/converters/package-info.java @@ -16,8 +16,8 @@ */ /** - * Standard implementations of the locale-aware {@link LocaleConverter} - * interface that are pre-registered with locale-aware {@link LocaleConvertUtils} + * Standard implementations of the locale-aware {@link org.apache.commons.beanutils.locale.LocaleConverter} + * interface that are pre-registered with locale-aware {@link org.apache.commons.beanutils.locale.LocaleConvertUtils} * at startup time. */ package org.apache.commons.beanutils.locale.converters; diff --git a/src/main/java/org/apache/commons/beanutils/package-info.java b/src/main/java/org/apache/commons/beanutils/package-info.java index f05993a9..7a812a0a 100644 --- a/src/main/java/org/apache/commons/beanutils/package-info.java +++ b/src/main/java/org/apache/commons/beanutils/package-info.java @@ -22,7 +22,7 @@ * in the JavaBeans Specification, as well as mechanisms for dynamically defining * and accessing bean properties.</p> * - * <h1>Table of Contents</h1> + * <h2>Table of Contents</h2> * * <ul> * <li>1. <a href="#overview">Overview</a> @@ -74,10 +74,8 @@ * </ul></li> * </ul> * - * <a name="overview"></a> - * <h1>1. Overview</h1> + * <h2>1. Overview</h2> * - * <a name="overview.background"></a> * <h2>1.1 Background</h2> * * <p>The <em>JavaBeans</em> name comes from a @@ -170,7 +168,6 @@ * System.out.println("Hello " + employee.getFirstName() + "!"); * </pre> * - * <a name="overview.dependencies"></a> * <h2>1.2 External Dependencies</h2> * * <p>The <em>commons-beanutils</em> package requires that the following @@ -183,10 +180,8 @@ * Collections Package (Apache Commons)</a>, version 1.0 or later</li> * </ul> * - * <a name="standard"></a> - * <h1>2. Standard JavaBeans</h1> + * <h2>2. Standard JavaBeans</h2> * - * <a name="standard.background"></a> * <h2>2.1 Background</h2> * * <p>As described above, the standard facilities of the Java programming language @@ -254,7 +249,6 @@ * } * </pre> * - * <a name="standard.basic"></a> * <h2>2.2 Basic Property Access</h2> * * <p>Getting and setting <strong>simple</strong> property values is, well, @@ -333,7 +327,6 @@ * PropertyUtils.setMappedProperty(employee, "address", "home", address); * </pre> * - * <a name="standard.nested"></a> * <h2>2.3 Nested Property Access</h2> * * <p>In all of the examples above, we have assumed that you wished to retrieve @@ -384,7 +377,6 @@ * "subordinate[3].address(home).city"); * </pre> * - * <a name="standard.customize"></a> * <h2>2.4 Customizing Introspection</h2> * * <p>As was pointed out, BeanUtils relies on conventions defined by the @@ -418,7 +410,6 @@ * non-void return type - thus enabling support for typical properties in a * fluent API.</p> * - * <a name="standard.suppress"></a> * <h2>2.5 Suppressing Properties</h2> * <p>The mechanism of customizing bean introspection described in the previous * section can also be used to suppress specific properties. There is a @@ -444,10 +435,8 @@ * <code>SUPPRESS_CLASS</code> constant of * <code>SuppressPropertiesBeanIntrospector</code>.</p> * - * <a name="dynamic"></a> - * <h1>3. Dynamic Beans (DynaBeans)</h1> + * <h2>3. Dynamic Beans (DynaBeans)</h2> * - * <a name="dynamic.background"></a> * <h2>3.1 Background</h2> * * <p>The {@link org.apache.commons.beanutils.PropertyUtils} class described in the @@ -498,7 +487,6 @@ * provide your own custom implementations for cases where the standard * implementations are not sufficient.</p> * - * <a name="dynamic.basic"></a> * <h2>3.2 <code>BasicDynaBean</code> and <code>BasicDynaClass</code></h2> * * <p>The {@link org.apache.commons.beanutils.BasicDynaBean} and @@ -550,7 +538,6 @@ * will be retrieved or modified, instead of underlying properties on the * actual BasicDynaBean implementation class.</p> * - * <a name="dynamic.resultSet"></a> * <h2>3.3 <code>ResultSetDynaClass</code> (Wraps ResultSet in DynaBeans)</h2> * * <p>A very common use case for DynaBean APIs is to wrap other collections of @@ -577,7 +564,6 @@ * </pre> * * - * <a name="dynamic.rowSet"></a> * <h2>3.4 <code>RowSetDynaClass</code> (Disconnected ResultSet as DynaBeans)</h2> * <p>Although <a href="#dynamic.resultSet"><code>ResultSetDynaClass</code></a> is * a very useful technique for representing the results of an SQL query as a @@ -625,7 +611,6 @@ * </pre> * * - * <a name="dynamic.wrap"></a> * <h2>3.5 <code>WrapDynaBean</code> and <code>WrapDynaClass</code></h2> * * <p>OK, you've tried the DynaBeans APIs and they are cool -- very simple @@ -649,7 +634,6 @@ * <p>Note that, although appropriate <code>WrapDynaClass</code> instances are * created internally, you never need to deal with them.</p> * - * <a name="dynamic.lazy"></a> * <h2>3.6 <em>Lazy</em> DynaBeans</h2> * * <ul> @@ -793,10 +777,8 @@ * will add properties automatically if the <code>DynaClass</code> is <em>restricted</em>.</p> * * - * <a name="conversion"></a> - * <h1>4. Data Type Conversions</h1> + * <h2>4. Data Type Conversions</h2> * - * <a name="conversion.background"></a> * <h3>4.1 Background</h3> * * <p>So far, we've only considered the cases where the data types of the @@ -806,7 +788,6 @@ * <em>BeanUtils</em> package provides a variety of APIs and design patterns * for performing this task as well.</p> * - * <a name="conversion.beanutils"></a> * <h3>4.2 <code>BeanUtils</code> and <code>ConvertUtils</code> Conversions</h3> * * <p>A very common use case (and the situation that caused the initial creation @@ -853,11 +834,10 @@ * of the {@link org.apache.commons.beanutils.Converter} interface instead. Therefore, * new code should not be written with reliance on ConvertUtils.</p> * - * <a name="conversion.defining"></a> * <h3>4.3 Defining Your Own Converters</h3> * * <p>The <code>ConvertUtils</code> class supports the ability to define and - * register your own String --> Object conversions for any given Java class. + * register your own String to Object conversions for any given Java class. * Once registered, such converters will be used transparently by all of the * <code>BeanUtils</code> methods (including <code>populate()</code>). To * create and register your own converter, follow these steps:</p> @@ -871,7 +851,6 @@ * by calling the <code>ConvertUtils.register()</code> method.</li> * </ul> * - * <a name="conversion.i18n"></a> * <h3>4.4 Locale Aware Conversions</h3> * <p>The standard classes in <code>org.apache.commons.beanutils</code> are not * locale aware. This gives them a cleaner interface and makes then easier to use @@ -882,9 +861,7 @@ * lines as the basic classes but support localization.</p> * * - * <a name="instances"></a> - * <h1>5. Utility Objects And Static Utility Classes</h1> - * <a name="instances.background"></a> + * <h2>5. Utility Objects And Static Utility Classes</h2> * <h3>Background</h3> * <p> * So far, the examples have covered the static utility classes (<code>BeanUtils</code>, @@ -896,28 +873,24 @@ * class use worker instances of these classes). For each static utility class, there is a corresponding * class with the same functionality that can be instantiated: * </p> - * <p> - * <table cols='2' width='60%'> + * <table> + * <caption>Utility classes</caption> * <tr><th>Static Utility Class</th><th>Utility Object</th></tr> * <tr><td>BeanUtils</td><td>BeanUtilsBean</td></tr> * <tr><td>ConvertUtils</td><td>ConvertUtilsBean</td></tr> * <tr><td>PropertyUtils</td><td>PropertyUtilsBean</td></tr> * </table> - * </p> * <p> * Creating an instances allow gives guarenteed control of the caching and registration * to the code that creates it. * </p> * - * <a name="collections"></a> - * <h1>6. Collections</h1> - * <a name="bean-comparator"></a> + * <h2>6. Collections</h2> * <h3>6.1 Comparing Beans</h3> * <p> * <code>org.apache.commons.beanutils.BeanComparator</code> is a <code>Comparator</code> implementation * that compares beans based on a shared property value. * </p> - * <a name="bean-property-closure"></a> * <h3>6.2 Operating On Collections Of Beans</h3> * <p> * The <code>Closure</code> interface in <code>commons-collections</code> encapsulates a block of code that @@ -933,17 +906,16 @@ * </p> * <p> * For example, set the activeEmployee property to TRUE for an entire collection: - * <code><pre> + * </p> + * <pre> * // create the closure * BeanPropertyValueChangeClosure closure = * new BeanPropertyValueChangeClosure( "activeEmployee", Boolean.TRUE ); * * // update the Collection * CollectionUtils.forAllDo( peopleCollection, closure ); - * </pre></code> - * </p> + * </pre> * - * <a name="bean-property-predicate"></a> * <h3>6.3 Querying Or Filtering Collections Of Beans</h3> * <p> * The <code>Predicate</code> interface in <code>commons-collections</code> encapsulates an evaluation @@ -961,14 +933,14 @@ * </p> * <p> * For example, to filter a collection to find all beans where active employee is false use: - * <code><pre> + * </p> + * <pre> * BeanPropertyValueEqualsPredicate predicate = * new BeanPropertyValueEqualsPredicate( "activeEmployee", Boolean.FALSE ); * * // filter the Collection * CollectionUtils.filter( peopleCollection, predicate ); - * </pre></code> - * </p> + * </pre> * * <a href="bean-property-transformer"></a> * <h3>6.4 Transforming Collections Of Beans</h3> @@ -988,25 +960,25 @@ * <p> * For example, to find all cities that are contained in the address of each person property of each bean in * a collection: - * <code><pre> + * </p> + * <pre> * // create the transformer * BeanToPropertyValueTransformer transformer = new BeanToPropertyValueTransformer( "person.address.city" ); * * // transform the Collection * Collection peoplesCities = CollectionUtils.collect( peopleCollection, transformer ); - * </pre></code> - * </p> + * </pre> * - * <a name="FAQ"></a> - * <h1>7. Frequently Asked Questions</h1> + * <h2>7. Frequently Asked Questions</h2> * - * <a name="FAQ.property"></a> * <h3>Why Can't BeanUtils Find My Method?</h3> * <p>The <em>BeanUtils</em> package relies on <em>introspection</em> rather than * <em>reflection</em>. This means that it will find only * <a href='http://java.sun.com/products/javabeans'><em>JavaBean</em> * compliant</a> properties.</p> - * <p>There are some subtleties of this specification that can catch out the unwary: + * <p> + * There are some subtleties of this specification that can catch out the unwary: + * </p> * <ul> * <li>A property can have only one set and one get method. Overloading is not allowed.</li> * <li>The <code>java.beans.Introspector</code> searches widely for a custom <em>BeanInfo</em> @@ -1015,8 +987,6 @@ * creating via reflection based on your class. If this happens, the only solution is to * create your own <em>BeanInfo</em>.</li> * </ul> - * </p> - * <a name="FAQ.bc.order"></a> * <h3>How Do I Set The BeanComparator Order To Be Ascending/Descending?</h3> * <p> * BeanComparator relies on an internal Comparator to perform the actual @@ -1029,7 +999,7 @@ * <p> * For example: * </p> - * <code><pre> + * <pre> * import org.apache.commons.collections.comparators.ComparableComparator; * import org.apache.commons.collections.comparators.ReverseComparator; * import org.apache.commons.beanutils.BeanComparator; @@ -1038,6 +1008,6 @@ * = new BeanComparator("propertyName", new ReverseComparator(new ComparableComparator())); * Collections.sort(myList, reversedNaturalOrderBeanComparator); * ... - * </pre></code> + * </pre> */ package org.apache.commons.beanutils;