|
Groovy 2.2.0 | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT |
java.lang.Object groovy.lang.DelegatesTo
@Documented @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.PARAMETER}) public @interface DelegatesTo
This annotation can be used by API or DSL writers to document parameters which accept a closure. In that case, using this annotation, you can specify what the delegate type of the closure will be. This is important for IDE support.
This annotation can also be used to help the type checker (TypeChecked) which would not report errors then if the delegate is of the documented type. Of course, it is also compatible with CompileStatic.
Example:
// Document the fact that the delegate of the closure will be an ExecSpec ExecResult exec(@DelegatesTo(ExecSpec) Closure closure) { ... }
Nested Class Summary | |
---|---|
static @interface |
DelegatesTo.Target
|
Optional Element Summary | |
---|---|
int |
genericTypeIndex
@default 1 |
int |
strategy
@default Closure.OWNER_FIRST |
java.lang.String |
target
@default "" |
java.lang.Class |
value
@default Target.class |
Method Summary |
---|
Methods inherited from class Object | |
---|---|
wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll |
Element Detail |
---|
public int genericTypeIndex
public int strategy
public String target
public Class value
Copyright © 2003-2013 The Codehaus. All rights reserved.