From 7b3968fe401c1db299a34feaba8f862069723e36 Mon Sep 17 00:00:00 2001 From: grootjans Date: Mon, 7 Feb 2011 22:44:55 +0100 Subject: Added documentation for @Delegate. This fixes issue 189 --- website/features/Delegate.html | 70 ++++++++++++++++++++++++++++++++++++++++++ website/features/index.html | 2 ++ website/features/val.html | 4 +-- 3 files changed, 74 insertions(+), 2 deletions(-) create mode 100644 website/features/Delegate.html (limited to 'website/features') diff --git a/website/features/Delegate.html b/website/features/Delegate.html new file mode 100644 index 00000000..bdb22c26 --- /dev/null +++ b/website/features/Delegate.html @@ -0,0 +1,70 @@ + + + + + + + + @Delegate +
+
+
+ +

@Delegate

+ +
+

Overview

+

+ NEW IN Lombok 0.10: Any field can be annotated with @Delegate to let lombok generate delegate methods that forward the call + to this field. +

+

+ Lombok delegates all public methods of the field's type, as well as those of its supertype except for all methods declared + in java.lang.Object. You can provide a specific implementation for a method by providing you own implementation, lombok will not + generate delegate methods for those already declared in the class. +

+

+ You can pass any number of classes into the @Delegate annotation. If you do that, then lombok will delegate all public + methods in those types (and their supertypes, except java.lang.Object) instead of looking at the field's type. +

+
+
+
+

With Lombok

+
@HTML_PRE@
+
+
+
+

Vanilla Java

+
@HTML_POST@
+
+
+
+
+

Small print

+

+ When passing classes to the annotation, these cannot contain generics. This is a limitation of java that lombok cannot work around. +

+

+ When passing classes to the annotation, these classes do not need to be supertypes of the field. See the example. +

+
+
+ +
+
+
+ + + diff --git a/website/features/index.html b/website/features/index.html index edc173fb..06b6763e 100644 --- a/website/features/index.html +++ b/website/features/index.html @@ -36,6 +36,8 @@
Captain's Log, stardate 24435.7: "What was that line again?"
val
Finally! hassle-free final local variables.
+
@Delegate
+
Don't lose your composition
diff --git a/website/features/val.html b/website/features/val.html index 4e05f8ca..f3e86447 100644 --- a/website/features/val.html +++ b/website/features/val.html @@ -50,8 +50,8 @@
-- cgit