# Interface ReportContainer<T extends Report>

Type Parameters:
  `T` - The base report type for reports of this container.

All Superinterfaces:
  `Collection<T>, Configurable<ReportContainer<T>>, DomainObjectCollection<T>, DomainObjectSet<T>, Iterable<T>, NamedDomainObjectCollection<T>, NamedDomainObjectSet<T>, Set<T>`

All Known Subinterfaces:
  `ArtifactTransformReports, BuildDashboardReports, CheckstyleReports, CodeNarcReports, ConfigurationReports, DependencyReportContainer, JacocoReportsContainer, PmdReports, TestTaskReports`

public interface ReportContainer<T extends Report> extends NamedDomainObjectSet<T>, Configurable<ReportContainer<T>>
A container of `Report` objects, that represent potential reports.

Things that produce reports (typically tasks) expose a report container that contains `Report` objects for each possible report that they can produce. Each report object can be configured individually, including whether or not it should be produced by way of its `Report.getRequired()` required} property.

`ReportContainer` implementations are immutable in that standard collection methods such as `add()`, `remove()` and `clear()` will throw an `ReportContainer.ImmutableViolationException`. However, implementations may provide new methods that allow the addition of new report object and/or the removal of existing report objects.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Interface
  Description
  `static class`
  `ReportContainer.ImmutableViolationException`
  The exception thrown when any of this container's mutation methods are called.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `SortedMap<String,T>`
  `getAsMap()`
  Returns the objects in this collection, as a map from object name to object instance.
  `Provider<? extends Collection<T>>`
  `getElements()`
  Return a provider containing all elements added to this collection.
  `NamedDomainObjectSet<T>`
  `getEnabled()`
  Returns an immutable collection of all the enabled `Report` objects in this container.
  `Map<String,T>`
  `getEnabledReports()`
  Returns the enabled reports, keyed by report name.
  `Namer<T>`
  `getNamer()`
  An object that represents the naming strategy used to name objects of this collection.
  `SortedSet<String>`
  `getNames()`
  Returns the names of the objects in this collection as a Set of Strings.
  `List<Rule>`
  `getRules()`
  Returns the rules used by this collection.
  `boolean`
  `isEmpty()`

  ### Methods inherited from interface Collection

  `parallelStream, removeIf, stream, toArray`

  ### Methods inherited from interface Configurable

  `configure`

  ### Methods inherited from interface DomainObjectCollection

  `addAllLater, addLater, all, all, configureEach, disallowChanges, whenObjectAdded, whenObjectAdded, whenObjectRemoved, whenObjectRemoved, withType, withType`

  ### Methods inherited from interface Iterable

  `forEach`

  ### Methods inherited from interface NamedDomainObjectCollection

  `add, addAll, addRule, addRule, addRule, findByName, getAt, getByName, getByName, getByName, getCollectionSchema, named, named, named, named`

  ### Methods inherited from interface NamedDomainObjectSet

  `findAll, matching, matching, named, withType`

  ### Methods inherited from interface Set

  `add, addAll, clear, contains, containsAll, equals, hashCode, iterator, remove, removeAll, retainAll, size, spliterator, toArray, toArray`

- ## Method Details

  - ### getEnabled

    @Internal NamedDomainObjectSet<T> getEnabled()
    Returns an immutable collection of all the enabled `Report` objects in this container.

    The returned collection is live. That is, as reports are enabled/disabled the returned collection always reflects the current set of enabled reports.

    Returns:
      The enabled reports.

  - ### getNamer

    @Internal Namer<T> getNamer()
    Description copied from interface: `NamedDomainObjectCollection`
    An object that represents the naming strategy used to name objects of this collection.
    Specified by:
      `getNamer` in interface `NamedDomainObjectCollection<T extends Report>`
    Returns:
      Object representing the naming strategy.

  - ### getAsMap

    @Internal SortedMap<String,T> getAsMap()
    Description copied from interface: `NamedDomainObjectCollection`
    Returns the objects in this collection, as a map from object name to object instance.

    The map is ordered by the natural ordering of the object names (i.e. keys).

    This operation is eager and will cause all elements of the collection to be realized.

    Specified by:
      `getAsMap` in interface `NamedDomainObjectCollection<T extends Report>`
    Returns:
      The objects. Returns an empty map if this collection is empty.

  - ### getNames

    @Internal SortedSet<String> getNames()
    Description copied from interface: `NamedDomainObjectCollection`
    Returns the names of the objects in this collection as a Set of Strings.

    The set of names is in natural ordering.

    This operation is lazy and pending elements of this collection will not be realized.

    Specified by:
      `getNames` in interface `NamedDomainObjectCollection<T extends Report>`
    Returns:
      The names. Returns an empty set if this collection is empty.

  - ### getRules

    @Internal List<Rule> getRules()
    Description copied from interface: `NamedDomainObjectCollection`
    Returns the rules used by this collection.
    Specified by:
      `getRules` in interface `NamedDomainObjectCollection<T extends Report>`
    Returns:
      The rules, in the order they will be applied.

  - ### isEmpty

    @Internal boolean isEmpty()
    Specified by:
      `isEmpty` in interface `Collection<T extends Report>`
    Specified by:
      `isEmpty` in interface `Set<T extends Report>`

  - ### getElements

    @Internal Provider<? extends Collection<T>> getElements()
    Description copied from interface: `DomainObjectCollection`
    Return a provider containing all elements added to this collection.

    The returned provider retains the build dependencies of providers added by `DomainObjectCollection.addLater(Provider)` or `DomainObjectCollection.addAllLater(Provider)`.

    The value produced by a provider with build dependencies, by definition, is not valid until those build dependencies are executed. For example, if a task produces an output file, the value of a provider returning that file is not valid until the task executes.

    Querying the contents of this provider before the build dependencies of providers added by `DomainObjectCollection.addLater(Provider)` and `DomainObjectCollection.addAllLater(Provider)` will result in undefined behavior. In general, the returned provider should only be used to wire values between tasks. Avoid directly calling `Provider.get()` or any other method that realizes the value of the returned provier.

    Specified by:
      `getElements` in interface `DomainObjectCollection<T extends Report>`

  - ### getEnabledReports

    Map<String,T> getEnabledReports()
    Returns the enabled reports, keyed by report name.
    Since:
      4.7