ObjectFactory

A factory for creating various kinds of model objects.

An instance of the factory can be injected into a task, plugin or other object by annotating a public constructor or property getter method with javax.inject.Inject. It is also available via getObjects.

Since

4.0

Inheritors

Functions

Link copied to clipboard
Creates a new DependencyCollector used for declaring dependencies.
Link copied to clipboard
Creates a new DirectoryProperty that uses the project directory to resolve relative paths, if required.
Link copied to clipboard
abstract fun <T> domainObjectContainer(elementType: Class<T>): NamedDomainObjectContainer<T>
Creates a new NamedDomainObjectContainer for managing named objects of the specified type.
Link copied to clipboard
inline fun <T : Any> ObjectFactory.domainObjectContainer(elementType: KClass<T>, factory: NamedDomainObjectFactory<T>): NamedDomainObjectContainer<T>

Kotlin extension function taking kotlin.reflect.KClass for org.gradle.api.model.ObjectFactory.domainObjectContainer.

Link copied to clipboard
abstract fun <T> domainObjectSet(elementType: Class<T>): DomainObjectSet<T>
Creates a new DomainObjectSet for managing objects of the specified type.
Link copied to clipboard
inline fun <T : Any> ObjectFactory.domainObjectSet(elementType: KClass<T>): DomainObjectSet<T>

Kotlin extension function taking kotlin.reflect.KClass for org.gradle.api.model.ObjectFactory.domainObjectSet.

Link copied to clipboard
Link copied to clipboard
Creates a new RegularFileProperty that uses the project directory to resolve relative paths, if required.
Link copied to clipboard
Creates a new ConfigurableFileTree.
Link copied to clipboard
abstract fun <T> listProperty(elementType: Class<T>): ListProperty<T>
Creates a ListProperty implementation to hold a List of the given element type T.
Link copied to clipboard

Creates a ListProperty that holds values of the given type T.

inline fun <T : Any> ObjectFactory.listProperty(elementType: KClass<T>): ListProperty<T>

Kotlin extension function taking kotlin.reflect.KClass for org.gradle.api.model.ObjectFactory.listProperty.

Link copied to clipboard
abstract fun <K, V> mapProperty(keyType: Class<K>, valueType: Class<V>): MapProperty<K, V>
Creates a MapProperty implementation to hold a Map of the given key type K and value type V.
Link copied to clipboard

Creates a MapProperty that holds values of the given key type K and value type V.

inline fun <K : Any, V : Any> ObjectFactory.mapProperty(keyType: KClass<K>, valueType: KClass<V>): MapProperty<K, V>

Kotlin extension function taking kotlin.reflect.KClass for org.gradle.api.model.ObjectFactory.mapProperty.

Link copied to clipboard
abstract fun <T : Named?> named(type: Class<T>, name: String): T
Creates a simple immutable Named object of the given type and name.
Link copied to clipboard
inline fun <T : Named> ObjectFactory.named(name: String): T

Creates a simple immutable Named object of the given type and name.

inline fun <T : Named> ObjectFactory.named(type: KClass<T>, name: String): T

Kotlin extension function taking kotlin.reflect.KClass for org.gradle.api.model.ObjectFactory.named.

Link copied to clipboard
abstract fun <T> namedDomainObjectList(elementType: Class<T>): NamedDomainObjectList<T>
Creates a new NamedDomainObjectList for managing named objects of the specified type.
Link copied to clipboard

Kotlin extension function taking kotlin.reflect.KClass for org.gradle.api.model.ObjectFactory.namedDomainObjectList.

Link copied to clipboard
abstract fun <T> namedDomainObjectSet(elementType: Class<T>): NamedDomainObjectSet<T>
Creates a new NamedDomainObjectSet for managing named objects of the specified type.
Link copied to clipboard

Kotlin extension function taking kotlin.reflect.KClass for org.gradle.api.model.ObjectFactory.namedDomainObjectSet.

Link copied to clipboard
abstract fun <T> newInstance(type: Class<out T>, parameters: Array<Any>): T
Create a new instance of T, using parameters as the construction parameters.
Link copied to clipboard
inline fun <T> ObjectFactory.newInstance(vararg parameters: Any): T

Create a new instance of T, using parameters as the construction parameters.

inline fun <T : Any> ObjectFactory.newInstance(type: KClass<out T>, vararg parameters: Any): T

Kotlin extension function taking kotlin.reflect.KClass for org.gradle.api.model.ObjectFactory.newInstance.

Link copied to clipboard
Creates a new ExtensiblePolymorphicDomainObjectContainer for managing named objects of the specified type.
Link copied to clipboard

Kotlin extension function taking kotlin.reflect.KClass for org.gradle.api.model.ObjectFactory.polymorphicDomainObjectContainer.

Link copied to clipboard
abstract fun <T> property(valueType: Class<T>): Property<T>
Creates a Property implementation to hold values of the given type.
Link copied to clipboard
inline fun <T> ObjectFactory.property(): Property<T>

Creates a Property that holds values of the given type T.

inline fun <T : Any> ObjectFactory.property(valueType: KClass<T>): Property<T>

Kotlin extension function taking kotlin.reflect.KClass for org.gradle.api.model.ObjectFactory.property.

Link copied to clipboard
abstract fun <T> setProperty(elementType: Class<T>): SetProperty<T>
Creates a SetProperty implementation to hold a Set of the given element type T.
Link copied to clipboard

Creates a SetProperty that holds values of the given type T.

inline fun <T : Any> ObjectFactory.setProperty(elementType: KClass<T>): SetProperty<T>

Kotlin extension function taking kotlin.reflect.KClass for org.gradle.api.model.ObjectFactory.setProperty.

Link copied to clipboard
abstract fun sourceDirectorySet(name: String, displayName: String): SourceDirectorySet