ObjectFactory

@ServiceScope(value = [Global::class, BuildTree::class, Project::class])
interface ObjectFactory(source)

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

Functions

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
abstract fun <T> domainObjectSet(elementType: Class<T>): DomainObjectSet<T>
Creates a new DomainObjectSet for managing objects of the specified type.
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
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
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
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
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
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
Creates a new ExtensiblePolymorphicDomainObjectContainer for managing named objects of the specified type.
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
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
abstract fun sourceDirectorySet(name: String, displayName: String): SourceDirectorySet