Content deleted Content added
add java Fluent plugin alongside Lombok and Manifold |
clarify how Fluent works without using annotations |
||
Line 14:
In C# they're implemented as static methods in static classes, with the first argument being of extended class and preceded by "<code>this</code>" keyword.
In Java you add extension methods via [http://manifold.systems/ Manifold], a jar file you add to your project's classpath. Similar to C# a Java extension method is declared static in an [http://manifold.systems/docs.html#extension-classes @Extension] class where the first argument has the same type as the extended class and is annotated with <code>@This</code>. Alternatively, the [https://github.com/rogerkeays/fluent Fluent] plugin allows you to call any static method as an extension method
In Smalltalk, any code can add a method to any class at any time, by sending a method creation message (such as <code>methodsFor:</code>) to the class the user wants to extend. The Smalltalk method category is conventionally named after the package that provides the extension, surrounded by asterisks. For example, when Etoys application code extends classes in the core library, the added methods are put in the <code>*etoys*</code> category.
|