apupier commented on code in PR #21086:
URL: https://github.com/apache/camel/pull/21086#discussion_r2732433507


##########
core/camel-console/src/main/java/org/apache/camel/impl/console/BeanDevConsole.java:
##########
@@ -105,6 +89,27 @@ protected String doCallText(Map<String, Object> options) {
         return sb.toString();
     }
 
+    private void appendBeanPropertiesText(StringBuilder sb, BeanIntrospection 
bi, Object bean, boolean nulls) {
+        Map<String, Object> values = new TreeMap<>();
+        try {
+            bi.getProperties(bean, values, null);
+        } catch (Throwable e) {
+            // ignore
+        }
+        values.forEach((pk, pv) -> appendPropertyText(sb, pk, pv, nulls));
+    }
+
+    private void appendPropertyText(StringBuilder sb, String pk, Object pv, 
boolean nulls) {
+        if (pv == null) {
+            if (nulls) {
+                sb.append(String.format("        %s = null%n", pk));
+            }
+            return;
+        }
+        String t = pv.getClass().getName();
+        sb.append(String.format("        %s (%s) = %s%n", pk, t, pv));

Review Comment:
   to avoid using `return` in the middle of the method and better read the 
if/else, it can be written as it was before:
   
   ```
           if (pv == null) {
               if (nulls) {
                   sb.append(String.format("        %s = null%n", pk));
               }
           } else {
               String t = pv.getClass().getName();
               sb.append(String.format("        %s (%s) = %s%n", pk, t, pv));
           }
   ```



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