Porting groovy code with closures to Java

I have a convenience method in a plugin written in Groovy:

ext.isWindows = {
    DefaultNativePlatform.currentOperatingSystem.isWindows()
}

I can call this like isWindows() from the project.

What would the equivalent be in pure Java? So far I have tried:

ExtraPropertiesExtension ext = project.getExtensions().getByType(ExtraPropertiesExtension.class);
ext.set("isWindows" (Callable<Boolean>) () -> DefaultNativePlatform.getCurrentOperatingSystem().isWindows());

and

ext.set("isWindows" project.getProviders().provider(() -> DefaultNativePlatform.getCurrentOperatingSystem().isWindows()));