Skip to content
Permalink
Browse files

Improved: Rewrite ‘EntityDataLoadContainer#isPropertySet’

(OFBIZ-11070)

Use a boolean expression instead of a conditional.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1860061 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
mthl committed May 26, 2019
1 parent 28e1190 commit 388f4c8b52dd5f0ee92097920effc1a1709c6ed2
@@ -191,22 +191,16 @@ private void loadDataForDelegator(Map<String, String> loadDataProps, Configurati
}
}

/*
* 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));
}

/*

0 comments on commit 388f4c8

Please sign in to comment.
You can’t perform that action at this time.