api / org.gradle.api.plugins / ExtensionContainer / findByType

findByType

abstract fun <T : Any> findByType(type: Class<T>): T

Looks for the extension of a given type (useful to avoid casting). If none found null is returned.

Parameters

type - extension type

Return
extension or null

@Incubating abstract fun <T : Any> findByType(type: TypeOf<T>): T

Looks for the extension of a given type (useful to avoid casting). If none found null is returned.

Parameters

type - extension type

Return
extension or null

Since
3.5