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.

getByType

abstract fun <T> getByType(type: Class<T>): T(source)

Looks for the extension of a given type (useful to avoid casting). If none found it will throw an exception.

Return

extension, never null

Since

1.0

Parameters

type

extension type

Throws

When the given extension is not found.


abstract fun <T> getByType(type: TypeOf<T>): T(source)

Looks for the extension of a given type (useful to avoid casting). If none found it will throw an exception.

Return

extension, never null

Since

3.5

Parameters

type

extension type

Throws

When the given extension is not found.