Skip to content

Commit 1a44d41

Browse files
committed
add useValue() in BundleBuilder
1 parent 68c00ea commit 1a44d41

File tree

4 files changed

+21
-3
lines changed

4 files changed

+21
-3
lines changed

.idea/compiler.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/runConfigurations.xml

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

custom/src/main/java/com/isolpro/custom/BundleBuilder.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,15 @@ public static BundleBuilder get() {
2020
return get(new Bundle());
2121
}
2222

23+
public static void useValue(Bundle bundle, String key, Callback<Object> onValue) {
24+
if (bundle == null) return;
25+
26+
if (!bundle.containsKey(key)) return;
27+
28+
if (onValue != null)
29+
onValue.exec(bundle.get(key));
30+
}
31+
2332
public BundleBuilder putString(String key, String value) {
2433
bundle.putString(key, value);
2534
return this;
@@ -62,5 +71,4 @@ public boolean getBoolean(String key) {
6271
public Bundle build() {
6372
return bundle;
6473
}
65-
6674
}

0 commit comments

Comments
 (0)