Modified: commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/DynaBeanMapDecorator.java URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/DynaBeanMapDecorator.java?rev=1632171&r1=1632170&r2=1632171&view=diff ============================================================================== --- commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/DynaBeanMapDecorator.java (original) +++ commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/DynaBeanMapDecorator.java Wed Oct 15 20:15:17 2014 @@ -79,7 +79,7 @@ public class DynaBeanMapDecorator extend * otherwise <code>false</code> * @throws IllegalArgumentException if the {@link DynaBean} is null. */ - public DynaBeanMapDecorator(DynaBean dynaBean, boolean readOnly) { + public DynaBeanMapDecorator(final DynaBean dynaBean, final boolean readOnly) { super(dynaBean, readOnly); } @@ -90,12 +90,12 @@ public class DynaBeanMapDecorator extend * @param dynaBean The dyna bean being decorated * @throws IllegalArgumentException if the {@link DynaBean} is null. */ - public DynaBeanMapDecorator(DynaBean dynaBean) { + public DynaBeanMapDecorator(final DynaBean dynaBean) { super(dynaBean); } @Override - protected Object convertKey(String propertyName) { + protected Object convertKey(final String propertyName) { return propertyName; } }
Modified: commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/DynaBeanPropertyMapDecorator.java URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/DynaBeanPropertyMapDecorator.java?rev=1632171&r1=1632170&r2=1632171&view=diff ============================================================================== --- commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/DynaBeanPropertyMapDecorator.java (original) +++ commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/DynaBeanPropertyMapDecorator.java Wed Oct 15 20:15:17 2014 @@ -71,7 +71,7 @@ public class DynaBeanPropertyMapDecorato * otherwise <code>false</code> * @throws IllegalArgumentException if the {@link DynaBean} is null. */ - public DynaBeanPropertyMapDecorator(DynaBean dynaBean, boolean readOnly) { + public DynaBeanPropertyMapDecorator(final DynaBean dynaBean, final boolean readOnly) { super(dynaBean, readOnly); } @@ -82,12 +82,12 @@ public class DynaBeanPropertyMapDecorato * @param dynaBean The dyna bean being decorated * @throws IllegalArgumentException if the {@link DynaBean} is null. */ - public DynaBeanPropertyMapDecorator(DynaBean dynaBean) { + public DynaBeanPropertyMapDecorator(final DynaBean dynaBean) { super(dynaBean); } @Override - protected String convertKey(String propertyName) { + protected String convertKey(final String propertyName) { return propertyName; } } Modified: commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/DynaProperty.java URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/DynaProperty.java?rev=1632171&r1=1632170&r2=1632171&view=diff ============================================================================== --- commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/DynaProperty.java (original) +++ commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/DynaProperty.java Wed Oct 15 20:15:17 2014 @@ -71,7 +71,7 @@ public class DynaProperty implements Ser * * @param name Name of the property being described */ - public DynaProperty(String name) { + public DynaProperty(final String name) { this(name, Object.class); @@ -84,7 +84,7 @@ public class DynaProperty implements Ser * @param name Name of the property being described * @param type Java class representing the property data type */ - public DynaProperty(String name, Class<?> type) { + public DynaProperty(final String name, final Class<?> type) { super(); this.name = name; @@ -103,7 +103,7 @@ public class DynaProperty implements Ser * @param type Java class representing the property data type * @param contentType Class that all indexed or mapped elements are instances of */ - public DynaProperty(String name, Class<?> type, Class<?> contentType) { + public DynaProperty(final String name, final Class<?> type, final Class<?> contentType) { super(); this.name = name; @@ -250,7 +250,7 @@ public class DynaProperty implements Ser @Override public String toString() { - StringBuilder sb = new StringBuilder("DynaProperty[name="); + final StringBuilder sb = new StringBuilder("DynaProperty[name="); sb.append(this.name); sb.append(",type="); sb.append(this.type); @@ -270,7 +270,7 @@ public class DynaProperty implements Ser * (including java 1.3). * This method provides a workaround. */ - private void writeObject(ObjectOutputStream out) throws IOException { + private void writeObject(final ObjectOutputStream out) throws IOException { writeAnyClass(this.type,out); @@ -285,7 +285,7 @@ public class DynaProperty implements Ser /** * Write a class using safe encoding to workaround java 1.3 serialization bug. */ - private void writeAnyClass(Class<?> clazz, ObjectOutputStream out) throws IOException { + private void writeAnyClass(final Class<?> clazz, final ObjectOutputStream out) throws IOException { // safely write out any class int primitiveType = 0; if (Boolean.TYPE.equals(clazz)) { @@ -325,7 +325,7 @@ public class DynaProperty implements Ser * * @throws StreamCorruptedException when the stream data values are outside expected range */ - private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { + private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException { this.type = readAnyClass(in); @@ -341,7 +341,7 @@ public class DynaProperty implements Ser /** * Reads a class using safe encoding to workaround java 1.3 serialization bug. */ - private Class<?> readAnyClass(ObjectInputStream in) throws IOException, ClassNotFoundException { + private Class<?> readAnyClass(final ObjectInputStream in) throws IOException, ClassNotFoundException { // read back type class safely if (in.readBoolean()) { // it's a type constant Modified: commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/FluentPropertyBeanIntrospector.java URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/FluentPropertyBeanIntrospector.java?rev=1632171&r1=1632170&r2=1632171&view=diff ============================================================================== --- commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/FluentPropertyBeanIntrospector.java (original) +++ commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/FluentPropertyBeanIntrospector.java Wed Oct 15 20:15:17 2014 @@ -94,7 +94,7 @@ public class FluentPropertyBeanIntrospec * @param writePrefix the prefix for write methods (must not be <b>null</b>) * @throws IllegalArgumentException if the prefix is <b>null</b> */ - public FluentPropertyBeanIntrospector(String writePrefix) { + public FluentPropertyBeanIntrospector(final String writePrefix) { if (writePrefix == null) { throw new IllegalArgumentException( "Prefix for write methods must not be null!"); @@ -128,12 +128,12 @@ public class FluentPropertyBeanIntrospec * @param icontext the introspection context * @throws IntrospectionException if an error occurs */ - public void introspect(IntrospectionContext icontext) + public void introspect(final IntrospectionContext icontext) throws IntrospectionException { - for (Method m : icontext.getTargetClass().getMethods()) { + for (final Method m : icontext.getTargetClass().getMethods()) { if (m.getName().startsWith(getWriteMethodPrefix())) { - String propertyName = propertyName(m); - PropertyDescriptor pd = icontext + final String propertyName = propertyName(m); + final PropertyDescriptor pd = icontext .getPropertyDescriptor(propertyName); try { if (pd == null) { @@ -142,7 +142,7 @@ public class FluentPropertyBeanIntrospec } else if (pd.getWriteMethod() == null) { pd.setWriteMethod(m); } - } catch (IntrospectionException e) { + } catch (final IntrospectionException e) { log.warn("Error when creating PropertyDescriptor for " + m + "! Ignoring this property.", e); } @@ -156,8 +156,8 @@ public class FluentPropertyBeanIntrospec * @param m the method * @return the corresponding property name */ - private String propertyName(Method m) { - String methodName = m.getName().substring( + private String propertyName(final Method m) { + final String methodName = m.getName().substring( getWriteMethodPrefix().length()); return (methodName.length() > 1) ? Character.toLowerCase(methodName .charAt(0)) + methodName.substring(1) : methodName @@ -172,8 +172,8 @@ public class FluentPropertyBeanIntrospec * @return the descriptor * @throws IntrospectionException if an error occurs */ - private PropertyDescriptor createFluentPropertyDescritor(Method m, - String propertyName) throws IntrospectionException { + private PropertyDescriptor createFluentPropertyDescritor(final Method m, + final String propertyName) throws IntrospectionException { return new PropertyDescriptor(propertyName(m), null, m); } } \ No newline at end of file Modified: commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/JDBCDynaClass.java URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/JDBCDynaClass.java?rev=1632171&r1=1632170&r2=1632171&view=diff ============================================================================== --- commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/JDBCDynaClass.java (original) +++ commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/JDBCDynaClass.java Wed Oct 15 20:15:17 2014 @@ -92,7 +92,7 @@ abstract class JDBCDynaClass implements * * @exception IllegalArgumentException if no property name is specified */ - public DynaProperty getDynaProperty(String name) { + public DynaProperty getDynaProperty(final String name) { if (name == null) { throw new IllegalArgumentException("No property name specified"); @@ -135,7 +135,7 @@ abstract class JDBCDynaClass implements * * @param useColumnLabel true if the column label should be used, otherwise false */ - public void setUseColumnLabel(boolean useColumnLabel) { + public void setUseColumnLabel(final boolean useColumnLabel) { this.useColumnLabel = useColumnLabel; } @@ -150,7 +150,7 @@ abstract class JDBCDynaClass implements * @exception SQLException if an exception was thrown trying to load * the specified class */ - protected Class<?> loadClass(String className) throws SQLException { + protected Class<?> loadClass(final String className) throws SQLException { try { ClassLoader cl = Thread.currentThread().getContextClassLoader(); @@ -159,7 +159,7 @@ abstract class JDBCDynaClass implements } // use Class.forName() - see BEANUTILS-327 return Class.forName(className, false, cl); - } catch (Exception e) { + } catch (final Exception e) { throw new SQLException( "Cannot load column class '" + className + "': " + e); } @@ -176,8 +176,8 @@ abstract class JDBCDynaClass implements * @throws SQLException If an error occurs accessing the SQL metadata */ protected DynaProperty createDynaProperty( - ResultSetMetaData metadata, - int i) + final ResultSetMetaData metadata, + final int i) throws SQLException { String columnName = null; @@ -187,7 +187,7 @@ abstract class JDBCDynaClass implements if (columnName == null || columnName.trim().length() == 0) { columnName = metadata.getColumnName(i); } - String name = lowerCase ? columnName.toLowerCase() : columnName; + final String name = lowerCase ? columnName.toLowerCase() : columnName; if (!name.equals(columnName)) { if (columnNameXref == null) { columnNameXref = new HashMap<String, String>(); @@ -196,7 +196,7 @@ abstract class JDBCDynaClass implements } String className = null; try { - int sqlType = metadata.getColumnType(i); + final int sqlType = metadata.getColumnType(i); switch (sqlType) { case java.sql.Types.DATE: return new DynaProperty(name, java.sql.Date.class); @@ -207,7 +207,7 @@ abstract class JDBCDynaClass implements default: className = metadata.getColumnClassName(i); } - } catch (SQLException e) { + } catch (final SQLException e) { // this is a patch for HsqlDb to ignore exceptions // thrown by its metadata implementation } @@ -233,14 +233,14 @@ abstract class JDBCDynaClass implements * @exception SQLException if an error is encountered processing the * result set metadata */ - protected void introspect(ResultSet resultSet) throws SQLException { + protected void introspect(final ResultSet resultSet) throws SQLException { // Accumulate an ordered list of DynaProperties - ArrayList<DynaProperty> list = new ArrayList<DynaProperty>(); - ResultSetMetaData metadata = resultSet.getMetaData(); - int n = metadata.getColumnCount(); + final ArrayList<DynaProperty> list = new ArrayList<DynaProperty>(); + final ResultSetMetaData metadata = resultSet.getMetaData(); + final int n = metadata.getColumnCount(); for (int i = 1; i <= n; i++) { // JDBC is one-relative! - DynaProperty dynaProperty = createDynaProperty(metadata, i); + final DynaProperty dynaProperty = createDynaProperty(metadata, i); if (dynaProperty != null) { list.add(dynaProperty); } @@ -263,14 +263,14 @@ abstract class JDBCDynaClass implements * @return The value * @throws SQLException if an error occurs */ - protected Object getObject(ResultSet resultSet, String name) throws SQLException { + protected Object getObject(final ResultSet resultSet, final String name) throws SQLException { - DynaProperty property = getDynaProperty(name); + final DynaProperty property = getDynaProperty(name); if (property == null) { throw new IllegalArgumentException("Invalid name '" + name + "'"); } - String columnName = getColumnName(name); - Class<?> type = property.getType(); + final String columnName = getColumnName(name); + final Class<?> type = property.getType(); // java.sql.Date if (type.equals(Date.class)) { @@ -297,7 +297,7 @@ abstract class JDBCDynaClass implements * @return The column name (which can be different if the <i>lowerCase</i> * option is used). */ - protected String getColumnName(String name) { + protected String getColumnName(final String name) { if (columnNameXref != null && columnNameXref.containsKey(name)) { return columnNameXref.get(name); } else { Modified: commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/LazyDynaBean.java URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/LazyDynaBean.java?rev=1632171&r1=1632170&r2=1632171&view=diff ============================================================================== --- commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/LazyDynaBean.java (original) +++ commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/LazyDynaBean.java Wed Oct 15 20:15:17 2014 @@ -168,7 +168,7 @@ public class LazyDynaBean implements Dyn * * @param name Name of this DynaBean class */ - public LazyDynaBean(String name) { + public LazyDynaBean(final String name) { this(new LazyDynaClass(name)); } @@ -179,7 +179,7 @@ public class LazyDynaBean implements Dyn * * @param dynaClass The DynaClass we are associated with */ - public LazyDynaBean(DynaClass dynaClass) { + public LazyDynaBean(final DynaClass dynaClass) { values = newMap(); @@ -218,13 +218,13 @@ public class LazyDynaBean implements Dyn * @return The indexed or mapped property size * @exception IllegalArgumentException if no property name is specified */ - public int size(String name) { + public int size(final String name) { if (name == null) { throw new IllegalArgumentException("No property name specified"); } - Object value = values.get(name); + final Object value = values.get(name); if (value == null) { return 0; } @@ -258,13 +258,13 @@ public class LazyDynaBean implements Dyn * * @exception IllegalArgumentException if no property name is specified */ - public boolean contains(String name, String key) { + public boolean contains(final String name, final String key) { if (name == null) { throw new IllegalArgumentException("No property name specified"); } - Object value = values.get(name); + final Object value = values.get(name); if (value == null) { return false; } @@ -287,7 +287,7 @@ public class LazyDynaBean implements Dyn * @return The property's value * @exception IllegalArgumentException if no property name is specified */ - public Object get(String name) { + public Object get(final String name) { if (name == null) { throw new IllegalArgumentException("No property name specified"); @@ -330,7 +330,7 @@ public class LazyDynaBean implements Dyn * @exception IndexOutOfBoundsException if the specified index * is outside the range of the underlying property */ - public Object get(String name, int index) { + public Object get(final String name, final int index) { // If its not a property, then create default indexed property if (!isDynaProperty(name)) { @@ -376,7 +376,7 @@ public class LazyDynaBean implements Dyn * @exception IllegalArgumentException if the specified property * exists, but is not mapped */ - public Object get(String name, String key) { + public Object get(final String name, final String key) { // If its not a property, then create default mapped property if (!isDynaProperty(name)) { @@ -384,7 +384,7 @@ public class LazyDynaBean implements Dyn } // Get the mapped property - Object mappedProperty = get(name); + final Object mappedProperty = get(name); // Check that the property is mapped if (!dynaClass.getDynaProperty(name).isMapped()) { @@ -426,13 +426,13 @@ public class LazyDynaBean implements Dyn * @exception IllegalArgumentException if there is no property * of the specified name */ - public void remove(String name, String key) { + public void remove(final String name, final String key) { if (name == null) { throw new IllegalArgumentException("No property name specified"); } - Object value = values.get(name); + final Object value = values.get(name); if (value == null) { return; } @@ -460,7 +460,7 @@ public class LazyDynaBean implements Dyn * @exception NullPointerException if an attempt is made to set a * primitive property to null */ - public void set(String name, Object value) { + public void set(final String name, final Object value) { // If the property doesn't exist, then add it if (!isDynaProperty(name)) { @@ -477,7 +477,7 @@ public class LazyDynaBean implements Dyn } - DynaProperty descriptor = dynaClass.getDynaProperty(name); + final DynaProperty descriptor = dynaClass.getDynaProperty(name); if (value == null) { if (descriptor.getType().isPrimitive()) { @@ -513,7 +513,7 @@ public class LazyDynaBean implements Dyn * @exception IndexOutOfBoundsException if the specified index * is outside the range of the underlying property */ - public void set(String name, int index, Object value) { + public void set(final String name, final int index, final Object value) { // If its not a property, then create default indexed property if (!isDynaProperty(name)) { @@ -538,6 +538,7 @@ public class LazyDynaBean implements Dyn Array.set(indexedProperty, index, value); } else if (indexedProperty instanceof List) { @SuppressWarnings("unchecked") + final // Indexed properties are stored in a List<Object> List<Object> values = (List<Object>) indexedProperty; values.set(index, value); @@ -563,7 +564,7 @@ public class LazyDynaBean implements Dyn * @exception IllegalArgumentException if the specified property * exists, but is not mapped */ - public void set(String name, String key, Object value) { + public void set(final String name, final String key, final Object value) { // If the 'mapped' property doesn't exist, then add it if (!isDynaProperty(name)) { @@ -571,7 +572,7 @@ public class LazyDynaBean implements Dyn } // Get the mapped property - Object mappedProperty = get(name); + final Object mappedProperty = get(name); // Check that the property is mapped if (!dynaClass.getDynaProperty(name).isMapped()) { @@ -582,6 +583,7 @@ public class LazyDynaBean implements Dyn // Set the value in the Map @SuppressWarnings("unchecked") + final // mapped properties are stored in a Map<String, Object> Map<String, Object> valuesMap = (Map<String, Object>) mappedProperty; valuesMap.put(key, value); @@ -598,16 +600,17 @@ public class LazyDynaBean implements Dyn * the required size) * @return The new property value (grown to the appropriate size) */ - protected Object growIndexedProperty(String name, Object indexedProperty, int index) { + protected Object growIndexedProperty(final String name, Object indexedProperty, final int index) { // Grow a List to the appropriate size if (indexedProperty instanceof List) { @SuppressWarnings("unchecked") + final // Indexed properties are stored as List<Object> List<Object> list = (List<Object>)indexedProperty; while (index >= list.size()) { - Class<?> contentType = getDynaClass().getDynaProperty(name).getContentType(); + final Class<?> contentType = getDynaClass().getDynaProperty(name).getContentType(); Object value = null; if (contentType != null) { value = createProperty(name+"["+list.size()+"]", contentType); @@ -620,14 +623,14 @@ public class LazyDynaBean implements Dyn // Grow an Array to the appropriate size if ((indexedProperty.getClass().isArray())) { - int length = Array.getLength(indexedProperty); + final int length = Array.getLength(indexedProperty); if (index >= length) { - Class<?> componentType = indexedProperty.getClass().getComponentType(); - Object newArray = Array.newInstance(componentType, (index + 1)); + final Class<?> componentType = indexedProperty.getClass().getComponentType(); + final Object newArray = Array.newInstance(componentType, (index + 1)); System.arraycopy(indexedProperty, 0, newArray, 0, length); indexedProperty = newArray; set(name, indexedProperty); - int newLength = Array.getLength(indexedProperty); + final int newLength = Array.getLength(indexedProperty); for (int i = length; i < newLength; i++) { Array.set(indexedProperty, i, createProperty(name+"["+i+"]", componentType)); } @@ -644,7 +647,7 @@ public class LazyDynaBean implements Dyn * @param type The class of the property * @return The new value */ - protected Object createProperty(String name, Class<?> type) { + protected Object createProperty(final String name, final Class<?> type) { if (type == null) { return null; } @@ -680,7 +683,7 @@ public class LazyDynaBean implements Dyn * @param type The class of the property * @return The new value */ - protected Object createIndexedProperty(String name, Class<?> type) { + protected Object createIndexedProperty(final String name, final Class<?> type) { // Create the indexed object Object indexedProperty = null; @@ -700,7 +703,7 @@ public class LazyDynaBean implements Dyn try { indexedProperty = type.newInstance(); } - catch (Exception ex) { + catch (final Exception ex) { throw new IllegalArgumentException ("Error instantiating indexed property of type '" + type.getName() + "' for '" + name + "' " + ex); @@ -722,7 +725,7 @@ public class LazyDynaBean implements Dyn * @param type The class of the property * @return The new value */ - protected Object createMappedProperty(String name, Class<?> type) { + protected Object createMappedProperty(final String name, final Class<?> type) { // Create the mapped object Object mappedProperty = null; @@ -739,7 +742,7 @@ public class LazyDynaBean implements Dyn try { mappedProperty = type.newInstance(); } - catch (Exception ex) { + catch (final Exception ex) { throw new IllegalArgumentException ("Error instantiating mapped property of type '" + type.getName() + "' for '" + name + "' " + ex); @@ -760,11 +763,11 @@ public class LazyDynaBean implements Dyn * @param type The class of the property * @return The new value */ - protected Object createDynaBeanProperty(String name, Class<?> type) { + protected Object createDynaBeanProperty(final String name, final Class<?> type) { try { return type.newInstance(); } - catch (Exception ex) { + catch (final Exception ex) { if (logger().isWarnEnabled()) { logger().warn("Error instantiating DynaBean property of type '" + type.getName() + "' for '" + name + "' " + ex); @@ -779,7 +782,7 @@ public class LazyDynaBean implements Dyn * @param type The class of the property * @return The new value */ - protected Object createPrimitiveProperty(String name, Class<?> type) { + protected Object createPrimitiveProperty(final String name, final Class<?> type) { if (type == Boolean.TYPE) { return Boolean.FALSE; @@ -809,7 +812,7 @@ public class LazyDynaBean implements Dyn * @param type The class of the property * @return The new value */ - protected Object createNumberProperty(String name, Class<?> type) { + protected Object createNumberProperty(final String name, final Class<?> type) { return null; @@ -821,7 +824,7 @@ public class LazyDynaBean implements Dyn * @param type The class of the property * @return The new value */ - protected Object createOtherProperty(String name, Class<?> type) { + protected Object createOtherProperty(final String name, final Class<?> type) { if (type == Object.class || type == String.class || @@ -836,7 +839,7 @@ public class LazyDynaBean implements Dyn try { return type.newInstance(); } - catch (Exception ex) { + catch (final Exception ex) { if (logger().isWarnEnabled()) { logger().warn("Error instantiating property of type '" + type.getName() + "' for '" + name + "' " + ex); } @@ -854,7 +857,7 @@ public class LazyDynaBean implements Dyn * @param name Name of the 'indexed property. * @return The default value for an indexed property (java.util.ArrayList) */ - protected Object defaultIndexedProperty(String name) { + protected Object defaultIndexedProperty(final String name) { return new ArrayList<Object>(); } @@ -868,7 +871,7 @@ public class LazyDynaBean implements Dyn * @param name Name of the 'mapped property. * @return The default value for a mapped property (java.util.HashMap) */ - protected Map<String, Object> defaultMappedProperty(String name) { + protected Map<String, Object> defaultMappedProperty(final String name) { return new HashMap<String, Object>(); } @@ -878,7 +881,7 @@ public class LazyDynaBean implements Dyn * @return <code>true</code> if there is a property of the * specified name, otherwise <code>false</code> */ - protected boolean isDynaProperty(String name) { + protected boolean isDynaProperty(final String name) { if (name == null) { throw new IllegalArgumentException("No property name specified"); @@ -902,7 +905,7 @@ public class LazyDynaBean implements Dyn * @return <code>true</code> if the source class is assignable to the * destination class, otherwise <code>false</code> */ - protected boolean isAssignable(Class<?> dest, Class<?> source) { + protected boolean isAssignable(final Class<?> dest, final Class<?> source) { if (dest.isAssignableFrom(source) || ((dest == Boolean.TYPE) && (source == Boolean.class)) || Modified: commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/LazyDynaClass.java URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/LazyDynaClass.java?rev=1632171&r1=1632170&r2=1632171&view=diff ============================================================================== --- commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/LazyDynaClass.java (original) +++ commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/LazyDynaClass.java Wed Oct 15 20:15:17 2014 @@ -69,7 +69,7 @@ public class LazyDynaClass extends Basic * * @param name Name of this DynaBean class */ - public LazyDynaClass(String name) { + public LazyDynaClass(final String name) { this(name, (DynaProperty[])null); } @@ -79,7 +79,7 @@ public class LazyDynaClass extends Basic * @param name Name of this DynaBean class * @param dynaBeanClass The implementation class for new instances */ - public LazyDynaClass(String name, Class<?> dynaBeanClass) { + public LazyDynaClass(final String name, final Class<?> dynaBeanClass) { this(name, dynaBeanClass, null); } @@ -89,7 +89,7 @@ public class LazyDynaClass extends Basic * @param name Name of this DynaBean class * @param properties Property descriptors for the supported properties */ - public LazyDynaClass(String name, DynaProperty[] properties) { + public LazyDynaClass(final String name, final DynaProperty[] properties) { this(name, LazyDynaBean.class, properties); } @@ -100,7 +100,7 @@ public class LazyDynaClass extends Basic * @param dynaBeanClass The implementation class for new instances * @param properties Property descriptors for the supported properties */ - public LazyDynaClass(String name, Class<?> dynaBeanClass, DynaProperty properties[]) { + public LazyDynaClass(final String name, final Class<?> dynaBeanClass, final DynaProperty properties[]) { super(name, dynaBeanClass, properties); } @@ -122,7 +122,7 @@ public class LazyDynaClass extends Basic * @param restricted <code>true</code> if this {@link MutableDynaClass} cannot * be changed otherwise <code>false</code> */ - public void setRestricted(boolean restricted) { + public void setRestricted(final boolean restricted) { this.restricted = restricted; } @@ -147,7 +147,7 @@ public class LazyDynaClass extends Basic * should be returned if the property doesn't exist, otherwise * <code>false</code> if a new {@link DynaProperty} should be created. */ - public void setReturnNull(boolean returnNull) { + public void setReturnNull(final boolean returnNull) { this.returnNull = returnNull; } @@ -161,7 +161,7 @@ public class LazyDynaClass extends Basic * @exception IllegalStateException if this DynaClass is currently * restricted, so no new properties can be added */ - public void add(String name) { + public void add(final String name) { add(new DynaProperty(name)); } @@ -177,7 +177,7 @@ public class LazyDynaClass extends Basic * @exception IllegalStateException if this DynaClass is currently * restricted, so no new properties can be added */ - public void add(String name, Class<?> type) { + public void add(final String name, final Class<?> type) { if (type == null) { add(name); } else { @@ -206,7 +206,7 @@ public class LazyDynaClass extends Basic * * @exception UnsupportedOperationException anytime this method is called */ - public void add(String name, Class<?> type, boolean readable, boolean writeable) { + public void add(final String name, final Class<?> type, final boolean readable, final boolean writeable) { throw new java.lang.UnsupportedOperationException("readable/writable properties not supported"); } @@ -219,7 +219,7 @@ public class LazyDynaClass extends Basic * @exception IllegalStateException if this DynaClass is currently * restricted, so no new properties can be added */ - protected void add(DynaProperty property) { + protected void add(final DynaProperty property) { if (property.getName() == null) { throw new IllegalArgumentException("Property name is missing."); @@ -235,8 +235,8 @@ public class LazyDynaClass extends Basic } // Create a new property array with the specified property - DynaProperty[] oldProperties = getDynaProperties(); - DynaProperty[] newProperties = new DynaProperty[oldProperties.length+1]; + final DynaProperty[] oldProperties = getDynaProperties(); + final DynaProperty[] newProperties = new DynaProperty[oldProperties.length+1]; System.arraycopy(oldProperties, 0, newProperties, 0, oldProperties.length); newProperties[oldProperties.length] = property; @@ -258,7 +258,7 @@ public class LazyDynaClass extends Basic * @exception IllegalStateException if this DynaClass is currently * restricted, so no properties can be removed */ - public void remove(String name) { + public void remove(final String name) { if (name == null) { throw new IllegalArgumentException("Property name is missing."); @@ -275,8 +275,8 @@ public class LazyDynaClass extends Basic // Create a new property array of without the specified property - DynaProperty[] oldProperties = getDynaProperties(); - DynaProperty[] newProperties = new DynaProperty[oldProperties.length-1]; + final DynaProperty[] oldProperties = getDynaProperties(); + final DynaProperty[] newProperties = new DynaProperty[oldProperties.length-1]; int j = 0; for (int i = 0; i < oldProperties.length; i++) { if (!(name.equals(oldProperties[i].getName()))) { @@ -314,7 +314,7 @@ public class LazyDynaClass extends Basic * @exception IllegalArgumentException if no property name is specified */ @Override - public DynaProperty getDynaProperty(String name) { + public DynaProperty getDynaProperty(final String name) { if (name == null) { throw new IllegalArgumentException("Property name is missing."); @@ -345,7 +345,7 @@ public class LazyDynaClass extends Basic * specified name, otherwise <code>false</code> * @exception IllegalArgumentException if no property name is specified */ - public boolean isDynaProperty(String name) { + public boolean isDynaProperty(final String name) { if (name == null) { throw new IllegalArgumentException("Property name is missing."); Modified: commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/LazyDynaList.java URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/LazyDynaList.java?rev=1632171&r1=1632170&r2=1632171&view=diff ============================================================================== --- commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/LazyDynaList.java (original) +++ commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/LazyDynaList.java Wed Oct 15 20:15:17 2014 @@ -201,7 +201,7 @@ public class LazyDynaList extends ArrayL * * @param capacity The initial capacity of the list. */ - public LazyDynaList(int capacity) { + public LazyDynaList(final int capacity) { super(capacity); } @@ -212,7 +212,7 @@ public class LazyDynaList extends ArrayL * * @param elementDynaClass The DynaClass of the List's elements. */ - public LazyDynaList(DynaClass elementDynaClass) { + public LazyDynaList(final DynaClass elementDynaClass) { super(); setElementDynaClass(elementDynaClass); } @@ -223,7 +223,7 @@ public class LazyDynaList extends ArrayL * * @param elementType The Type of the List's elements. */ - public LazyDynaList(Class<?> elementType) { + public LazyDynaList(final Class<?> elementType) { super(); setElementType(elementType); } @@ -234,7 +234,7 @@ public class LazyDynaList extends ArrayL * * @param collection The Collection to populate the List from. */ - public LazyDynaList(Collection<?> collection) { + public LazyDynaList(final Collection<?> collection) { super(collection.size()); addAll(collection); } @@ -245,7 +245,7 @@ public class LazyDynaList extends ArrayL * * @param array The Array to populate the List from. */ - public LazyDynaList(Object[] array) { + public LazyDynaList(final Object[] array) { super(array.length); for (int i = 0; i < array.length; i++) { add(array[i]); @@ -266,9 +266,9 @@ public class LazyDynaList extends ArrayL * @param element The new element to add. */ @Override - public void add(int index, Object element) { + public void add(final int index, final Object element) { - DynaBean dynaBean = transform(element); + final DynaBean dynaBean = transform(element); growList(index); @@ -283,9 +283,9 @@ public class LazyDynaList extends ArrayL * @return true. */ @Override - public boolean add(Object element) { + public boolean add(final Object element) { - DynaBean dynaBean = transform(element); + final DynaBean dynaBean = transform(element); return super.add(dynaBean); @@ -298,7 +298,7 @@ public class LazyDynaList extends ArrayL * @return true if elements were added. */ @Override - public boolean addAll(Collection<?> collection) { + public boolean addAll(final Collection<?> collection) { if (collection == null || collection.size() == 0) { return false; @@ -306,7 +306,7 @@ public class LazyDynaList extends ArrayL ensureCapacity(size() + collection.size()); - for (Object e : collection) { + for (final Object e : collection) { add(e); } @@ -327,7 +327,7 @@ public class LazyDynaList extends ArrayL * @return true if elements were added. */ @Override - public boolean addAll(int index, Collection<?> collection) { + public boolean addAll(final int index, final Collection<?> collection) { if (collection == null || collection.size() == 0) { return false; @@ -345,7 +345,7 @@ public class LazyDynaList extends ArrayL growList(index); int currentIndex = index; - for (Object e : collection) { + for (final Object e : collection) { add(currentIndex++, e); } @@ -364,7 +364,7 @@ public class LazyDynaList extends ArrayL * @return The element at the specified position. */ @Override - public Object get(int index) { + public Object get(final int index) { growList(index + 1); @@ -384,9 +384,9 @@ public class LazyDynaList extends ArrayL * @return The new element. */ @Override - public Object set(int index, Object element) { + public Object set(final int index, final Object element) { - DynaBean dynaBean = transform(element); + final DynaBean dynaBean = transform(element); growList(index + 1); @@ -416,7 +416,7 @@ public class LazyDynaList extends ArrayL return new LazyDynaBean[0]; } - Object[] array = (Object[])Array.newInstance(elementType, size()); + final Object[] array = (Object[])Array.newInstance(elementType, size()); for (int i = 0; i < size(); i++) { if (Map.class.isAssignableFrom(elementType)) { array[i] = ((LazyDynaMap)get(i)).getMap(); @@ -438,9 +438,9 @@ public class LazyDynaList extends ArrayL * @return An Array of the elements in this List. */ @Override - public <T> T[] toArray(T[] model) { + public <T> T[] toArray(final T[] model) { - Class<?> arrayType = model.getClass().getComponentType(); + final Class<?> arrayType = model.getClass().getComponentType(); if ((DynaBean.class.isAssignableFrom(arrayType)) || (size() == 0 && elementType == null)) { return super.toArray(model); @@ -452,6 +452,7 @@ public class LazyDynaList extends ArrayL array = model; } else { @SuppressWarnings("unchecked") + final // This is safe because we know the element type T[] tempArray = (T[]) Array.newInstance(arrayType, size()); array = tempArray; @@ -491,7 +492,7 @@ public class LazyDynaList extends ArrayL return new LazyDynaBean[0]; } - DynaBean[] array = (DynaBean[])Array.newInstance(elementDynaBeanType, size()); + final DynaBean[] array = (DynaBean[])Array.newInstance(elementDynaBeanType, size()); for (int i = 0; i < size(); i++) { array[i] = (DynaBean)get(i); } @@ -506,13 +507,13 @@ public class LazyDynaList extends ArrayL * @exception IllegalArgumentException if the List already * contains elements or the DynaClass is null. */ - public void setElementType(Class<?> elementType) { + public void setElementType(final Class<?> elementType) { if (elementType == null) { throw new IllegalArgumentException("Element Type is missing"); } - boolean changeType = (this.elementType != null && !this.elementType.equals(elementType)); + final boolean changeType = (this.elementType != null && !this.elementType.equals(elementType)); if (changeType && size() > 0) { throw new IllegalStateException("Element Type cannot be reset"); } @@ -523,7 +524,7 @@ public class LazyDynaList extends ArrayL Object object = null; try { object = elementType.newInstance(); - } catch (Exception e) { + } catch (final Exception e) { throw new IllegalArgumentException("Error creating type: " + elementType.getName() + " - " + e); } @@ -559,7 +560,7 @@ public class LazyDynaList extends ArrayL * @exception IllegalArgumentException if the List already * contains elements or the DynaClass is null. */ - public void setElementDynaClass(DynaClass elementDynaClass) { + public void setElementDynaClass(final DynaClass elementDynaClass) { if (elementDynaClass == null) { throw new IllegalArgumentException("Element DynaClass is missing"); @@ -571,7 +572,7 @@ public class LazyDynaList extends ArrayL // Try to create a new instance of the DynaBean try { - DynaBean dynaBean = elementDynaClass.newInstance(); + final DynaBean dynaBean = elementDynaClass.newInstance(); this.elementDynaBeanType = dynaBean.getClass(); if (WrapDynaBean.class.isAssignableFrom(elementDynaBeanType)) { this.elementType = ((WrapDynaBean)dynaBean).getInstance().getClass(); @@ -583,7 +584,7 @@ public class LazyDynaList extends ArrayL this.elementType = dynaBean.getClass(); this.elementDynaClass = elementDynaClass; } - } catch (Exception e) { + } catch (final Exception e) { throw new IllegalArgumentException( "Error creating DynaBean from " + elementDynaClass.getClass().getName() + " - " + e); @@ -601,7 +602,7 @@ public class LazyDynaList extends ArrayL * * @param requiredSize the required size of the List. */ - private void growList(int requiredSize) { + private void growList(final int requiredSize) { if (requiredSize < size()) { return; @@ -610,7 +611,7 @@ public class LazyDynaList extends ArrayL ensureCapacity(requiredSize + 1); for (int i = size(); i < requiredSize; i++) { - DynaBean dynaBean = transform(null); + final DynaBean dynaBean = transform(null); super.add(dynaBean); } @@ -628,7 +629,7 @@ public class LazyDynaList extends ArrayL * @param element The element to transformed. * @param The DynaBean to store in the List. */ - private DynaBean transform(Object element) { + private DynaBean transform(final Object element) { DynaBean dynaBean = null; Class<?> newDynaBeanType = null; @@ -652,7 +653,7 @@ public class LazyDynaList extends ArrayL try { dynaBean = getDynaClass().newInstance(); newDynaBeanType = dynaBean.getClass(); - } catch (Exception e) { + } catch (final Exception e) { throw new IllegalArgumentException("Error creating DynaBean: " + getDynaClass().getClass().getName() + " - " + e); @@ -699,8 +700,9 @@ public class LazyDynaList extends ArrayL * @param value the property value * @return the newly created {@code LazyDynaMap} */ - private LazyDynaMap createDynaBeanForMapProperty(Object value) { + private LazyDynaMap createDynaBeanForMapProperty(final Object value) { @SuppressWarnings("unchecked") + final // map properties are always stored as Map<String, Object> Map<String, Object> valueMap = (Map<String, Object>) value; return new LazyDynaMap(valueMap); Modified: commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/LazyDynaMap.java URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/LazyDynaMap.java?rev=1632171&r1=1632170&r2=1632171&view=diff ============================================================================== --- commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/LazyDynaMap.java (original) +++ commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/LazyDynaMap.java Wed Oct 15 20:15:17 2014 @@ -81,7 +81,7 @@ public class LazyDynaMap extends LazyDyn * * @param name Name of this DynaBean class */ - public LazyDynaMap(String name) { + public LazyDynaMap(final String name) { this(name, (Map<String, Object>)null); } @@ -90,7 +90,7 @@ public class LazyDynaMap extends LazyDyn * * @param values The Map backing this <code>LazyDynaMap</code> */ - public LazyDynaMap(Map<String, Object> values) { + public LazyDynaMap(final Map<String, Object> values) { this(null, values); } @@ -100,7 +100,7 @@ public class LazyDynaMap extends LazyDyn * @param name Name of this DynaBean class * @param values The Map backing this <code>LazyDynaMap</code> */ - public LazyDynaMap(String name, Map<String, Object> values) { + public LazyDynaMap(final String name, final Map<String, Object> values) { this.name = name == null ? "LazyDynaMap" : name; this.values = values == null ? newMap() : values; this.dynaClass = this; @@ -111,7 +111,7 @@ public class LazyDynaMap extends LazyDyn * * @param properties Property descriptors for the supported properties */ - public LazyDynaMap(DynaProperty[] properties) { + public LazyDynaMap(final DynaProperty[] properties) { this(null, properties); } @@ -121,7 +121,7 @@ public class LazyDynaMap extends LazyDyn * @param name Name of this DynaBean class * @param properties Property descriptors for the supported properties */ - public LazyDynaMap(String name, DynaProperty[] properties) { + public LazyDynaMap(final String name, final DynaProperty[] properties) { this(name, (Map<String, Object>)null); if (properties != null) { for (int i = 0; i < properties.length; i++) { @@ -135,7 +135,7 @@ public class LazyDynaMap extends LazyDyn * * @param dynaClass DynaClass to copy the name and properties from */ - public LazyDynaMap(DynaClass dynaClass) { + public LazyDynaMap(final DynaClass dynaClass) { this(dynaClass.getName(), dynaClass.getDynaProperties()); } @@ -146,7 +146,7 @@ public class LazyDynaMap extends LazyDyn * * @param values The new Map of values */ - public void setMap(Map<String, Object> values) { + public void setMap(final Map<String, Object> values) { this.values = values; } @@ -169,7 +169,7 @@ public class LazyDynaMap extends LazyDyn * @param value Value to which this property is to be set */ @Override - public void set(String name, Object value) { + public void set(final String name, final Object value) { if (isRestricted() && !values.containsKey(name)) { throw new IllegalArgumentException @@ -215,7 +215,7 @@ public class LazyDynaMap extends LazyDyn * * @exception IllegalArgumentException if no property name is specified */ - public DynaProperty getDynaProperty(String name) { + public DynaProperty getDynaProperty(final String name) { if (name == null) { throw new IllegalArgumentException("Property name is missing."); @@ -227,7 +227,7 @@ public class LazyDynaMap extends LazyDyn return null; } - Object value = values.get(name); + final Object value = values.get(name); if (value == null) { return new DynaProperty(name); @@ -250,10 +250,10 @@ public class LazyDynaMap extends LazyDyn public DynaProperty[] getDynaProperties() { int i = 0; - DynaProperty[] properties = new DynaProperty[values.size()]; - for (Map.Entry<String, Object> e : values.entrySet()) { - String name = e.getKey(); - Object value = values.get(name); + final DynaProperty[] properties = new DynaProperty[values.size()]; + for (final Map.Entry<String, Object> e : values.entrySet()) { + final String name = e.getKey(); + final Object value = values.get(name); properties[i++] = new DynaProperty(name, value == null ? null : value.getClass()); } @@ -273,16 +273,17 @@ public class LazyDynaMap extends LazyDyn Map<String, Object> newMap = null; try { @SuppressWarnings("unchecked") + final // The new map is used as properties map Map<String, Object> temp = getMap().getClass().newInstance(); newMap = temp; - } catch(Exception ex) { + } catch(final Exception ex) { newMap = newMap(); } // Crate new LazyDynaMap and initialize properties - LazyDynaMap lazyMap = new LazyDynaMap(newMap); - DynaProperty[] properties = this.getDynaProperties(); + final LazyDynaMap lazyMap = new LazyDynaMap(newMap); + final DynaProperty[] properties = this.getDynaProperties(); if (properties != null) { for (int i = 0; i < properties.length; i++) { lazyMap.add(properties[i]); @@ -313,7 +314,7 @@ public class LazyDynaMap extends LazyDyn * * @param restricted The new restricted state */ - public void setRestricted(boolean restricted) { + public void setRestricted(final boolean restricted) { this.restricted = restricted; } @@ -325,7 +326,7 @@ public class LazyDynaMap extends LazyDyn * * @exception IllegalArgumentException if name is null */ - public void add(String name) { + public void add(final String name) { add(name, null); } @@ -341,7 +342,7 @@ public class LazyDynaMap extends LazyDyn * @exception IllegalStateException if this DynaClass is currently * restricted, so no new properties can be added */ - public void add(String name, Class<?> type) { + public void add(final String name, final Class<?> type) { if (name == null) { throw new IllegalArgumentException("Property name is missing."); @@ -351,7 +352,7 @@ public class LazyDynaMap extends LazyDyn throw new IllegalStateException("DynaClass is currently restricted. No new properties can be added."); } - Object value = values.get(name); + final Object value = values.get(name); // Check if the property already exists if (value == null) { @@ -381,7 +382,7 @@ public class LazyDynaMap extends LazyDyn * * @exception UnsupportedOperationException anytime this method is called */ - public void add(String name, Class<?> type, boolean readable, boolean writeable) { + public void add(final String name, final Class<?> type, final boolean readable, final boolean writeable) { throw new java.lang.UnsupportedOperationException("readable/writable properties not supported"); } @@ -392,7 +393,7 @@ public class LazyDynaMap extends LazyDyn * * @exception IllegalArgumentException if name is null */ - protected void add(DynaProperty property) { + protected void add(final DynaProperty property) { add(property.getName(), property.getType()); } @@ -409,7 +410,7 @@ public class LazyDynaMap extends LazyDyn * @exception IllegalStateException if this DynaClass is currently * restricted, so no properties can be removed */ - public void remove(String name) { + public void remove(final String name) { if (name == null) { throw new IllegalArgumentException("Property name is missing."); @@ -451,7 +452,7 @@ public class LazyDynaMap extends LazyDyn * should be returned if the property doesn't exist, otherwise * <code>false</code> if a new {@link DynaProperty} should be created. */ - public void setReturnNull(boolean returnNull) { + public void setReturnNull(final boolean returnNull) { this.returnNull = returnNull; } @@ -472,7 +473,7 @@ public class LazyDynaMap extends LazyDyn * @exception IllegalArgumentException if no property name is specified */ @Override - protected boolean isDynaProperty(String name) { + protected boolean isDynaProperty(final String name) { if (name == null) { throw new IllegalArgumentException("Property name is missing."); Modified: commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/MappedPropertyDescriptor.java URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/MappedPropertyDescriptor.java?rev=1632171&r1=1632170&r2=1632171&view=diff ============================================================================== --- commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/MappedPropertyDescriptor.java (original) +++ commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/MappedPropertyDescriptor.java Wed Oct 15 20:15:17 2014 @@ -83,7 +83,7 @@ public class MappedPropertyDescriptor ex * @exception IntrospectionException if an exception occurs during * introspection. */ - public MappedPropertyDescriptor(String propertyName, Class<?> beanClass) + public MappedPropertyDescriptor(final String propertyName, final Class<?> beanClass) throws IntrospectionException { super(propertyName, null, null); @@ -94,7 +94,7 @@ public class MappedPropertyDescriptor ex } setName(propertyName); - String base = capitalizePropertyName(propertyName); + final String base = capitalizePropertyName(propertyName); // Look for mapped read method and matching write method Method mappedReadMethod = null; @@ -103,13 +103,13 @@ public class MappedPropertyDescriptor ex try { mappedReadMethod = getMethod(beanClass, "get" + base, STRING_CLASS_PARAMETER); - } catch (IntrospectionException e) { + } catch (final IntrospectionException e) { mappedReadMethod = getMethod(beanClass, "is" + base, STRING_CLASS_PARAMETER); } - Class<?>[] params = { String.class, mappedReadMethod.getReturnType() }; + final Class<?>[] params = { String.class, mappedReadMethod.getReturnType() }; mappedWriteMethod = getMethod(beanClass, "set" + base, params); - } catch (IntrospectionException e) { + } catch (final IntrospectionException e) { /* Swallow IntrospectionException * TODO: Why? */ @@ -149,8 +149,8 @@ public class MappedPropertyDescriptor ex * @exception IntrospectionException if an exception occurs during * introspection. */ - public MappedPropertyDescriptor(String propertyName, Class<?> beanClass, - String mappedGetterName, String mappedSetterName) + public MappedPropertyDescriptor(final String propertyName, final Class<?> beanClass, + final String mappedGetterName, final String mappedSetterName) throws IntrospectionException { super(propertyName, null, null); @@ -168,7 +168,7 @@ public class MappedPropertyDescriptor ex getMethod(beanClass, mappedGetterName, STRING_CLASS_PARAMETER); if (mappedReadMethod != null) { - Class<?>[] params = { String.class, mappedReadMethod.getReturnType() }; + final Class<?>[] params = { String.class, mappedReadMethod.getReturnType() }; mappedWriteMethod = getMethod(beanClass, mappedSetterName, params); } else { @@ -195,8 +195,8 @@ public class MappedPropertyDescriptor ex * @exception IntrospectionException if an exception occurs during * introspection. */ - public MappedPropertyDescriptor(String propertyName, - Method mappedGetter, Method mappedSetter) + public MappedPropertyDescriptor(final String propertyName, + final Method mappedGetter, final Method mappedSetter) throws IntrospectionException { super(propertyName, mappedGetter, mappedSetter); @@ -245,7 +245,7 @@ public class MappedPropertyDescriptor ex * @throws IntrospectionException If an error occurs finding the * mapped property */ - public void setMappedReadMethod(Method mappedGetter) + public void setMappedReadMethod(final Method mappedGetter) throws IntrospectionException { mappedReadMethodRef = new MappedMethodReference(mappedGetter); findMappedPropertyType(); @@ -268,7 +268,7 @@ public class MappedPropertyDescriptor ex * @throws IntrospectionException If an error occurs finding the * mapped property */ - public void setMappedWriteMethod(Method mappedSetter) + public void setMappedWriteMethod(final Method mappedSetter) throws IntrospectionException { mappedWriteMethodRef = new MappedMethodReference(mappedSetter); findMappedPropertyType(); @@ -282,8 +282,8 @@ public class MappedPropertyDescriptor ex */ private void findMappedPropertyType() throws IntrospectionException { try { - Method mappedReadMethod = getMappedReadMethod(); - Method mappedWriteMethod = getMappedWriteMethod(); + final Method mappedReadMethod = getMappedReadMethod(); + final Method mappedWriteMethod = getMappedWriteMethod(); Class<?> mappedPropertyType = null; if (mappedReadMethod != null) { if (mappedReadMethod.getParameterTypes().length != 1) { @@ -299,7 +299,7 @@ public class MappedPropertyDescriptor ex } if (mappedWriteMethod != null) { - Class<?>[] params = mappedWriteMethod.getParameterTypes(); + final Class<?>[] params = mappedWriteMethod.getParameterTypes(); if (params.length != 2) { throw new IntrospectionException ("bad mapped write method arg count"); @@ -312,7 +312,7 @@ public class MappedPropertyDescriptor ex mappedPropertyType = params[1]; } mappedPropertyTypeRef = new SoftReference<Class<?>>(mappedPropertyType); - } catch (IntrospectionException ex) { + } catch (final IntrospectionException ex) { throw ex; } } @@ -323,12 +323,12 @@ public class MappedPropertyDescriptor ex * * @param s The property name */ - private static String capitalizePropertyName(String s) { + private static String capitalizePropertyName(final String s) { if (s.length() == 0) { return s; } - char[] chars = s.toCharArray(); + final char[] chars = s.toCharArray(); chars[0] = Character.toUpperCase(chars[0]); return new String(chars); } @@ -336,19 +336,19 @@ public class MappedPropertyDescriptor ex /** * Find a method on a class with a specified number of parameters. */ - private static Method internalGetMethod(Class<?> initial, String methodName, - int parameterCount) { + private static Method internalGetMethod(final Class<?> initial, final String methodName, + final int parameterCount) { // For overridden methods we need to find the most derived version. // So we start with the given class and walk up the superclass chain. for (Class<?> clazz = initial; clazz != null; clazz = clazz.getSuperclass()) { - Method[] methods = clazz.getDeclaredMethods(); + final Method[] methods = clazz.getDeclaredMethods(); for (int i = 0; i < methods.length; i++) { - Method method = methods[i]; + final Method method = methods[i]; if (method == null) { continue; } // skip static methods. - int mods = method.getModifiers(); + final int mods = method.getModifiers(); if (!Modifier.isPublic(mods) || Modifier.isStatic(mods)) { continue; @@ -363,9 +363,9 @@ public class MappedPropertyDescriptor ex // Now check any inherited interfaces. This is necessary both when // the argument class is itself an interface, and when the argument // class is an abstract class. - Class<?>[] interfaces = initial.getInterfaces(); + final Class<?>[] interfaces = initial.getInterfaces(); for (int i = 0; i < interfaces.length; i++) { - Method method = internalGetMethod(interfaces[i], methodName, parameterCount); + final Method method = internalGetMethod(interfaces[i], methodName, parameterCount); if (method != null) { return method; } @@ -377,13 +377,13 @@ public class MappedPropertyDescriptor ex /** * Find a method on a class with a specified number of parameters. */ - private static Method getMethod(Class<?> clazz, String methodName, int parameterCount) + private static Method getMethod(final Class<?> clazz, final String methodName, final int parameterCount) throws IntrospectionException { if (methodName == null) { return null; } - Method method = internalGetMethod(clazz, methodName, parameterCount); + final Method method = internalGetMethod(clazz, methodName, parameterCount); if (method != null) { return method; } @@ -396,18 +396,18 @@ public class MappedPropertyDescriptor ex /** * Find a method on a class with a specified parameter list. */ - private static Method getMethod(Class<?> clazz, String methodName, Class<?>[] parameterTypes) + private static Method getMethod(final Class<?> clazz, final String methodName, final Class<?>[] parameterTypes) throws IntrospectionException { if (methodName == null) { return null; } - Method method = MethodUtils.getMatchingAccessibleMethod(clazz, methodName, parameterTypes); + final Method method = MethodUtils.getMatchingAccessibleMethod(clazz, methodName, parameterTypes); if (method != null) { return method; } - int parameterCount = (parameterTypes == null) ? 0 : parameterTypes.length; + final int parameterCount = (parameterTypes == null) ? 0 : parameterTypes.length; // No Method found throw new IntrospectionException("No method \"" + methodName + @@ -430,13 +430,13 @@ public class MappedPropertyDescriptor ex private Reference<Class<?>> writeParamTypeRef0; private Reference<Class<?>> writeParamTypeRef1; private String[] writeParamClassNames; - MappedMethodReference(Method m) { + MappedMethodReference(final Method m) { if (m != null) { className = m.getDeclaringClass().getName(); methodName = m.getName(); methodRef = new SoftReference<Method>(m); classRef = new WeakReference<Class<?>>(m.getDeclaringClass()); - Class<?>[] types = m.getParameterTypes(); + final Class<?>[] types = m.getParameterTypes(); if (types.length == 2) { writeParamTypeRef0 = new WeakReference<Class<?>>(types[0]); writeParamTypeRef1 = new WeakReference<Class<?>>(types[1]); @@ -487,7 +487,7 @@ public class MappedPropertyDescriptor ex m = clazz.getMethod(methodName, paramTypes); // Un-comment following line for testing // System.out.println("Recreated Method " + methodName + " for " + className); - } catch (NoSuchMethodException e) { + } catch (final NoSuchMethodException e) { throw new RuntimeException("Method " + methodName + " for " + className + " could not be reconstructed - method not found"); } @@ -506,7 +506,7 @@ public class MappedPropertyDescriptor ex /** * Try to re-load the class */ - private Class<?> reLoadClass(String name) { + private Class<?> reLoadClass(final String name) { ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); @@ -514,7 +514,7 @@ public class MappedPropertyDescriptor ex if (classLoader != null) { try { return classLoader.loadClass(name); - } catch (ClassNotFoundException e) { + } catch (final ClassNotFoundException e) { // ignore } } @@ -523,7 +523,7 @@ public class MappedPropertyDescriptor ex classLoader = MappedPropertyDescriptor.class.getClassLoader(); try { return classLoader.loadClass(name); - } catch (ClassNotFoundException e) { + } catch (final ClassNotFoundException e) { return null; } }
