Skip to content

Commit

Permalink
no arg mapper returns default value
Browse files Browse the repository at this point in the history
  • Loading branch information
brachy84 committed Jul 5, 2024
1 parent 7a7eb44 commit 54af456
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ T invoke(String s, Object... args) {
return Objects.requireNonNull(t.getValue(), "Object napper result must contain a non-null value!");
}

T invokeDefault() {
Result<T> t = this.defaultValue.get();
return t == null || t.hasError() ? null : t.getValue();
}

public GroovyContainer<?> getMod() {
return mod;
}
Expand Down Expand Up @@ -114,6 +119,10 @@ public T doCall(String s, Object... args) {
return invoke(s, args);
}

public T doCall() {
return invokeDefault();
}

@Override
public String getDocumentation() {
return documentation;
Expand Down

0 comments on commit 54af456

Please sign in to comment.