svn commit: r1860836 - /ofbiz/ofbiz-framework/trunk/framework/entityext/src/main/java/org/apache/ofbiz/entityext/data/EntityDataLoadContainer.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1860836 - /ofbiz/ofbiz-framework/trunk/framework/entityext/src/main/java/org/apache/ofbiz/entityext/data/EntityDataLoadContainer.java

mthl
Author: mthl
Date: Sat Jun  8 14:54:38 2019
New Revision: 1860836

URL: http://svn.apache.org/viewvc?rev=1860836&view=rev
Log:
Improved: Rewrite ‘EntityDataLoadContainer#isPropertySet’
(OFBIZ-11070)

Use a boolean expression instead of a conditional.

Modified:
    ofbiz/ofbiz-framework/trunk/framework/entityext/src/main/java/org/apache/ofbiz/entityext/data/EntityDataLoadContainer.java

Modified: ofbiz/ofbiz-framework/trunk/framework/entityext/src/main/java/org/apache/ofbiz/entityext/data/EntityDataLoadContainer.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/entityext/src/main/java/org/apache/ofbiz/entityext/data/EntityDataLoadContainer.java?rev=1860836&r1=1860835&r2=1860836&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/entityext/src/main/java/org/apache/ofbiz/entityext/data/EntityDataLoadContainer.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/entityext/src/main/java/org/apache/ofbiz/entityext/data/EntityDataLoadContainer.java Sat Jun  8 14:54:38 2019
@@ -191,22 +191,16 @@ public class EntityDataLoadContainer imp
         }
     }
 
-    /*
-     * If the user passed a flag, then make sure to set it to true if it has no
-     * value or its value is the string "true".
+    /**
+     * Checks if a key is associated with either the string {@code "true"} or {@code null}.
      *
-     * key=true   -> true
-     * key        -> true
-     * key=false  -> false
-     * (no-key)   -> false
+     * @param props  the map associating keys to values
+     * @param key  the key to look for in {@code props}
+     * @return {@code true} if {@code key} is associated with {@code "true"} or {@code null} in {@code props}.
      */
-    private boolean isPropertySet(Map<String, String> props, String key) {
+    private static boolean isPropertySet(Map<String, String> props, String key) {
         String value = props.get(key);
-        if (props.containsKey(key) && (value == null || "true".equalsIgnoreCase(value))) {
-            return true;
-        } else {
-            return false;
-        }
+        return props.containsKey(key) && (value == null || "true".equalsIgnoreCase(value));
     }
 
     /*