garydgregory commented on a change in pull request #25:
URL: https://github.com/apache/commons-beanutils/pull/25#discussion_r432839481



##########
File path: src/main/java/org/apache/commons/beanutils2/ConvertUtilsBean.java
##########
@@ -172,8 +172,8 @@
 
 public class ConvertUtilsBean {
 
-    private static final Integer ZERO = Integer.valueOf(0);
-    private static final Character SPACE = Character.valueOf(' ');
+    private static final Integer ZERO = 0;

Review comment:
       -1 See previous comment.

##########
File path: src/main/java/org/apache/commons/beanutils2/BasicDynaBean.java
##########
@@ -144,19 +144,19 @@ public Object get(final String name) {
         if (type == Boolean.TYPE) {
             return Boolean.FALSE;
         } else if (type == Byte.TYPE) {
-            return Byte.valueOf((byte) 0);
+            return (byte) 0;

Review comment:
       -1: For a low-level library, I prefer to see boxing and unboxing 
explicit so we can best understand where it happens and then consider any 
performance issues. For example, in this case `Byte.valueOf((byte) 0)` and 
other similar calls in this method should be refactored into constants, which 
I've done in git master, so please rebase.

##########
File path: src/main/java/org/apache/commons/beanutils2/BasicDynaClass.java
##########
@@ -165,7 +165,7 @@ public DynaProperty getDynaProperty(final String name) {
     }
 
     /**
-     * <p>Return an array of {@code ProperyDescriptors} for the properties
+     * <p>Return an array of {@code PropertyDescriptors} for the properties

Review comment:
       -1: This is still wrong the class name is `PropertyDescriptor`.

##########
File path: src/main/java/org/apache/commons/beanutils2/LazyDynaMap.java
##########
@@ -239,7 +239,7 @@ public DynaProperty getDynaProperty(final String name) {
     }
 
     /**
-     * <p>Return an array of {@code ProperyDescriptors} for the properties
+     * <p>Return an array of {@code PropertyDescriptors} for the properties

Review comment:
       See previous comment.

##########
File path: src/main/java/org/apache/commons/beanutils2/JDBCDynaClass.java
##########
@@ -106,7 +106,7 @@ public DynaProperty getDynaProperty(final String name) {
     }
 
     /**
-     * <p>Return an array of {@code ProperyDescriptors} for the properties
+     * <p>Return an array of {@code PropertyDescriptors} for the properties

Review comment:
       See previous comment.

##########
File path: src/main/java/org/apache/commons/beanutils2/PropertyUtilsBean.java
##########
@@ -504,7 +504,7 @@ public Object getIndexedProperty(final Object bean,
             readMethod = MethodUtils.getAccessibleMethod(bean.getClass(), 
readMethod);
             if (readMethod != null) {
                 final Object[] subscript = new Object[1];
-                subscript[0] = Integer.valueOf(index);
+                subscript[0] = index;

Review comment:
       See previous comment.

##########
File path: 
src/main/java/org/apache/commons/beanutils2/converters/DateTimeConverter.java
##########
@@ -341,7 +341,7 @@ protected String convertToString(final Object value) throws 
Throwable {
         // Handle Long
         if (value instanceof Long) {
             final Long longObj = (Long)value;
-            return toDate(targetType, longObj.longValue());
+            return toDate(targetType, longObj);

Review comment:
       See previous comment.

##########
File path: 
src/main/java/org/apache/commons/beanutils2/converters/CharacterConverter.java
##########
@@ -84,7 +84,7 @@ protected String convertToString(final Object value) {
     @Override
     protected <T> T convertToType(final Class<T> type, final Object value) 
throws Exception {
         if (Character.class.equals(type) || Character.TYPE.equals(type)) {
-            return type.cast(Character.valueOf(value.toString().charAt(0)));
+            return type.cast(value.toString().charAt(0));
         }

Review comment:
       See previous comment.

##########
File path: 
src/main/java/org/apache/commons/beanutils2/locale/converters/ByteLocaleConverter.java
##########
@@ -217,6 +217,6 @@ protected Object parse(final Object value, final String 
pattern) throws ParseExc
             throw new ConversionException("Supplied number is not of type 
Byte: " + parsed.longValue());
         }
         // now returns property Byte
-        return Byte.valueOf(parsed.byteValue());
+        return parsed.byteValue();

Review comment:
       See previous comment.

##########
File path: src/main/java/org/apache/commons/beanutils2/DynaClass.java
##########
@@ -47,10 +47,10 @@
      *
      * @throws IllegalArgumentException if no property name is specified
      */
-    public DynaProperty getDynaProperty(String name);
+    DynaProperty getDynaProperty(String name);
 
     /**
-     * <p>Returns an array of {@code ProperyDescriptors} for the properties
+     * <p>Returns an array of {@code PropertyDescriptors} for the properties

Review comment:
       See previous comment.

##########
File path: src/main/java/org/apache/commons/beanutils2/LazyDynaBean.java
##########
@@ -134,19 +134,19 @@
     /** BigDecimal Zero */
     protected static final BigDecimal BigDecimal_ZERO = new BigDecimal("0");
     /** Character Space */
-    protected static final Character  Character_SPACE = Character.valueOf(' ');
+    protected static final Character  Character_SPACE = ' ';

Review comment:
       See previous comment.

##########
File path: src/main/java/org/apache/commons/beanutils2/PropertyUtilsBean.java
##########
@@ -1589,7 +1573,7 @@ public void setIndexedProperty(final Object bean, final 
String name,
             writeMethod = MethodUtils.getAccessibleMethod(bean.getClass(), 
writeMethod);
             if (writeMethod != null) {
                 final Object[] subscript = new Object[2];
-                subscript[0] = Integer.valueOf(index);
+                subscript[0] = index;

Review comment:
       See previous comment.

##########
File path: src/main/java/org/apache/commons/beanutils2/WrapDynaClass.java
##########
@@ -184,7 +184,7 @@ public DynaProperty getDynaProperty(final String name) {
 
 
     /**
-     * <p>Return an array of {@code ProperyDescriptors} for the properties
+     * <p>Return an array of {@code PropertyDescriptors} for the properties

Review comment:
       See previous comment.

##########
File path: 
src/main/java/org/apache/commons/beanutils2/locale/converters/FloatLocaleConverter.java
##########
@@ -219,6 +219,6 @@ protected Object parse(final Object value, final String 
pattern) throws ParseExc
       if (posDouble != 0 && (posDouble < Float.MIN_VALUE || posDouble > 
Float.MAX_VALUE)) {
           throw new ConversionException("Supplied number is not of type Float: 
"+parsed);
       }
-      return Float.valueOf(parsed.floatValue()); // unlike superclass it 
returns Float type
+      return parsed.floatValue(); // unlike superclass it returns Float type

Review comment:
       See previous comment.

##########
File path: 
src/main/java/org/apache/commons/beanutils2/converters/DateTimeConverter.java
##########
@@ -240,7 +240,7 @@ protected String convertToString(final Object value) throws 
Throwable {
         } else if (value instanceof Calendar) {
             date = ((Calendar)value).getTime();
         } else if (value instanceof Long) {
-            date = new Date(((Long)value).longValue());
+            date = new Date((Long) value);

Review comment:
       See previous comment.

##########
File path: 
src/main/java/org/apache/commons/beanutils2/converters/NumberConverter.java
##########
@@ -243,17 +243,17 @@ protected String convertToString(final Object value) 
throws Throwable {
 
         // Handle Boolean
         if (value instanceof Boolean) {
-            return toNumber(sourceType, targetType, 
((Boolean)value).booleanValue() ? ONE : ZERO);
+            return toNumber(sourceType, targetType, (Boolean) value ? ONE : 
ZERO);

Review comment:
       See previous comment.

##########
File path: 
src/main/java/org/apache/commons/beanutils2/converters/NumberConverter.java
##########
@@ -87,8 +87,8 @@
  */
 public abstract class NumberConverter extends AbstractConverter {
 
-    private static final Integer ZERO = Integer.valueOf(0);
-    private static final Integer ONE  = Integer.valueOf(1);
+    private static final Integer ZERO = 0;

Review comment:
       See previous comment.

##########
File path: 
src/main/java/org/apache/commons/beanutils2/locale/converters/IntegerLocaleConverter.java
##########
@@ -215,8 +215,8 @@ public IntegerLocaleConverter(final Object defaultValue, 
final Locale locale, fi
     protected Object parse(final Object value, final String pattern) throws 
ParseException {
         final Number parsed = (Number) super.parse(value, pattern);
         if (parsed.longValue() != parsed.intValue()) {
-            throw new ConversionException("Suplied number is not of type 
Integer: " + parsed.longValue());
+            throw new ConversionException("Supplied number is not of type 
Integer: " + parsed.longValue());
         }
-        return Integer.valueOf(parsed.intValue()); // unlike superclass it 
will return proper Integer
+        return parsed.intValue(); // unlike superclass it will return proper 
Integer

Review comment:
       See previous comment.

##########
File path: 
src/main/java/org/apache/commons/beanutils2/locale/converters/DoubleLocaleConverter.java
##########
@@ -212,7 +212,7 @@ public DoubleLocaleConverter(final Object defaultValue, 
final Locale locale, fin
     protected Object parse(final Object value, final String pattern) throws 
ParseException {
         final Number result = (Number) super.parse(value, pattern);
         if (result instanceof Long) {
-            return Double.valueOf(result.doubleValue());
+            return result.doubleValue();

Review comment:
       See previous comment.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to