This annotation can also be used to help the type checker (groovy.)
which would not report errors then if the delegate is of the documented type. Of course, it is
also compatible with groovy..
Example:
// Document the fact that the delegate of the closure will be an ExecSpec
ExecResult exec(@DelegatesTo(ExecSpec) Closure closure) { ... }
| Modifier and Type | Class and Description |
|---|---|
| public static @interface | DelegatesTo.Target
Parameter annotation used to specify the delegate for a |
| Modifier and Type | Method and Description |
|---|---|
| public int | |
| public int | |
| public String | target()
In cases when there are multiple |
| public String | Returns: a String representation of a typeThe type member should be used when the type of the delegate cannot
be represented with |
| public Class |
| genericTypeIndex | back to summary |
|---|---|
| public int genericTypeIndex() The index of the generic type that will be the type of the closure's delegate.
The generic types are considered with respect to the | |
| strategy | back to summary |
|---|---|
| public int strategy() The | |
| target | back to summary |
|---|---|
| public String target() In cases when there are multiple | |
| type | back to summary |
|---|---|
| public String type() The type member should be used when the type of the delegate cannot
be represented with
| |
| value | back to summary |
|---|---|
| public Class | |
@DelegatesTo annotated
parameter of the same method.
| Modifier and Type | Method and Description |
|---|---|
| public String | value()
An identifier that should be used to disambiguate targets when there are
multiple |
| value | back to summary |
|---|---|
| public String value() An identifier that should be used to disambiguate targets when there are
multiple | |