api / org.gradle.api.file / FileCollection / asType

asType

abstract fun asType(type: Class<*>): Any

Converts this collection into an object of the specified type. Supported types are: Collection, List, Set, Object[], File[], File, and FileTree.

You can call this method in your build script using the as operator.

Parameters

type - The type to convert to.

Exceptions

org.codehaus.groovy.runtime.typehandling.GroovyCastException - When an unsupported type is specified.

Return
The converted value.