What would be the benefit ?

The logging libraries provide such API but there one want to avoid
calculating the log message unless really needed.
In our case the "name" is not something expensive to calculate. It is a
static string (always?!).

What would bring value is using the Java 8 goodies to read the parameter
name via reflection, but for this the application should use '-parameters'
compile argument. See https://github.com/isisaddons/isis-metamodel-paraname8

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Fri, Nov 25, 2016 at 12:48 PM, Ernesto Reinaldo Barreiro <
[email protected]> wrote:

> *public class *Args
> {
>     *public static *<T> T notNull(T argument, Supplier<String> name) {
>         *if*(argument == *null*) {
>             *throw new *IllegalArgumentException(name.get() + *" may not
> be
> null"*);
>         } *else *{
>             *return *argument;
>         }
>     }
>
>     *public void *test() {
>         Args.*notNull*(*this*, ()-> *"this"*);
>     }
> }
>
> On Fri, Nov 25, 2016 at 12:25 PM, Martin Grigorov <[email protected]>
> wrote:
>
> > How the new usage would look like ?
> >
> > Martin Grigorov
> > Wicket Training and Consulting
> > https://twitter.com/mtgrigorov
> >
> > On Fri, Nov 25, 2016 at 12:08 PM, Ernesto Reinaldo Barreiro <
> > [email protected]> wrote:
> >
> > > Hi,
> > >
> > > Does it make sense to use lambdas for things like
> > >
> > > https://github.com/apache/wicket/blob/master/wicket-
> > > util/src/main/java/org/apache/wicket/util/lang/Args.java#L37
> > >
> > > ?
> > >
> > > --
> > > Regards - Ernesto Reinaldo Barreiro
> > >
> >
>
>
>
> --
> Regards - Ernesto Reinaldo Barreiro
>

Reply via email to