For AI agents: the documentation index is at https://docs.gradle.org/llms.txt. Request any page with the header Accept: text/markdown to get Markdown. User manual pages are also available as Markdown by replacing .html with .md in the URL.

get

abstract fun <T> get(viewType: Class<T>): T(source)

Returns an instance of the given type that accesses the additional data.

Since

8.13

Parameters

viewType

the view type of the additional data

This represents the interface or class through which you want to access the underlying data. The system will return an implementation of this type that provides a specific "view" of the data, allowing for type-safe access to underlying data. The view type must be compatible with the actual data structure.

Limitations of the view type:

  • Allowed types: Only specific types are supported:
  • Provider API mapping (Provider API types are not allowed in view types): Provider API types (such as org.gradle.api.provider.Property) can be mapped to their corresponding allowed types, e.g. Property<String> getName() can be represented as String getName()