garydgregory commented on a change in pull request #773:
URL: https://github.com/apache/commons-lang/pull/773#discussion_r654951361



##########
File path: src/main/java/org/apache/commons/lang3/ObjectUtils.java
##########
@@ -228,6 +227,18 @@ public static boolean anyNull(final Object... values) {
         return !allNotNull(values);
     }
 
+    /**
+     * Casts the object to the targeted class.
+     * @param value the object to cast
+     * @param castClass the class to which the object must be cast to
+     * @param <T> the type of the cast object
+     * @return the cast object, otherwise {@code null}
+     */

Review comment:
       New main public and protected methods need a Javadoc since tag.

##########
File path: src/main/java/org/apache/commons/lang3/ObjectUtils.java
##########
@@ -228,6 +227,18 @@ public static boolean anyNull(final Object... values) {
         return !allNotNull(values);
     }
 
+    /**
+     * Casts the object to the targeted class.
+     * @param value the object to cast
+     * @param castClass the class to which the object must be cast to
+     * @param <T> the type of the cast object
+     * @return the cast object, otherwise {@code null}
+     */
+    public static <T> T cast(Object value, Class<T> castClass) {
+        return (castClass != null) && castClass.isInstance(value) ? 
castClass.cast(value) : null;

Review comment:
       Match the style of the file: Use final where possible, no need for extra 
parentheses.




-- 
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