Pace2Car commented on code in PR #27991:
URL: https://github.com/apache/shardingsphere/pull/27991#discussion_r1286932114


##########
infra/util/src/main/java/org/apache/shardingsphere/infra/util/reflection/ReflectionUtils.java:
##########
@@ -134,4 +137,36 @@ public static <T> T invokeMethod(final Method method, 
final Object target, final
         }
         return result;
     }
+    
+    /**
+     * Get field value by get method.
+     *
+     * @param target target
+     * @param fieldName field name
+     * @param <T> type of field value
+     * @return field value
+     */
+    public static <T> Optional<T> getFieldValueByGetMethod(final Object 
target, final String fieldName) {
+        String getterName = GETTER_PREFIX + 
CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_CAMEL, fieldName);
+        final Method method = findMethod(target.getClass(), getterName);
+        if (method != null) {
+            T value = invokeMethod(method, target);
+            return Optional.ofNullable(value);
+        }
+        

Review Comment:
   redundant blank line.



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

To unsubscribe, e-mail: [email protected]

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

Reply via email to