Created
July 14, 2012 07:31
-
-
Save kiris/3109849 to your computer and use it in GitHub Desktop.
lombok @ExtensionMethod sample.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import lombok.experimental.ExtensionMethod; | |
// @ExtensionMethod({ String.class }) // Compile Error. | |
@ExtensionMethod({ Extensions.class }) | |
public class Main { | |
public static void main(String[] args) { | |
System.out.println("Hello, %s".format("World.")); // => "Hello, World." | |
} | |
} | |
class Extensions { | |
public static String format(String format, Object ... args) { | |
return String.format(format, args); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment