[
https://issues.apache.org/jira/browse/LANG-1477?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16914252#comment-16914252
]
Peter Verhas commented on LANG-1477:
------------------------------------
Yes, and no. This is the functionality I was looking for, but the
implementation is copy-paste. The same structure already exists in the static
method {{Functions.run(FailableRunnable<T> pRunnable)}}. Therefore the
implementation of the functions has to be
{code:java}
static <K extends Throwable> Runnable castToRunnable(FailableRunnable<K> s) {
return () -> run(s);
}
{code}
And when I realized that the implementation is so simple, I am now less
convinced that we need this {{asRunnable(FailableRunnable<T> pRunnable)}}
function /and the similar others/ at all.
Even though I suggested this change in the first place I would vote not to
implement it into the class {{Functions}} increasing the footprint of the API.
Instead, I would go for extending the documentation explaining that the already
available methods, like {{run(FailableRunnable<T> pRunnable)}} can be used as
{{()->run(pRunnable)}} to convert a {{FailableRunnable}} to a {{Runnable}}.
> Implement castToXXX in Functions class
> --------------------------------------
>
> Key: LANG-1477
> URL: https://issues.apache.org/jira/browse/LANG-1477
> Project: Commons Lang
> Issue Type: Bug
> Components: lang.*
> Affects Versions: 3.9
> Reporter: Peter Verhas
> Assignee: Jochen Wiedmann
> Priority: Minor
> Labels: newbie
> Fix For: 3.10
>
> Original Estimate: 168h
> Remaining Estimate: 168h
>
> Proposal to implement functional interface conversion functions in the class
> {{org.apache.commons.lang3.Functions}} that convert {{FailableXXX}} to
> {{XXX}}.
> For example, the FailableRunnable can be converted with the method:
>
> {code:java}
> static <K extends Throwable> Runnable castToRunnable(FailableRunnable<K> s) {
> return () -> run(s);
> }{code}
>
>
--
This message was sent by Atlassian Jira
(v8.3.2#803003)