Annotation Type Nested


  • @Retention(RUNTIME)
    @Target({METHOD,FIELD})
    public @interface Nested

    Marks a property as specifying a nested bean, whose properties should be checked for annotations.

    This annotation should be attached to the getter method in Java or the property in Groovy. Annotations on setters or just the field in Java are ignored.

    Gradle will attempt to instantiate a nested bean on abstract getter methods annotated with this annotation. This creates a read-only managed nested property.

    The implementation of the nested bean is tracked as an input, too. This allows tracking behavior such as Actions as task inputs.

    This annotations supports Provider values by treating the result of Provider.get() as a nested bean.

    This annotation supports Iterable values by treating each element as a separate nested bean. As a property name, the index of the element in the iterable prefixed by $ is used, e.g. $0. If the element implements Named, then the property name is composed of Named.getName() and the index, e.g. name$1. The ordering of the elements in the iterable is crucial for reliable up-to-date checks and caching.

    This annotation supports $Map values by treating each value of the map as a separate nested bean. The keys of the map are used as property names.