# ModelMap

@Incubating
interface ModelMap<T> : Iterable<T> , ModelElement(source)

Model backed map like structure allowing adding of items where instantiation is managed.

org.gradle.model.Managed types may declare model map properties. Model maps can only contain managed types.

#### Parameters

<T>

the contract type for all items

#### Inheritors

TestSuiteContainer
BinaryContainer
ComponentSpecContainer
FunctionalSourceSet

## Functions

afterEach
Link copied to clipboard
abstract fun afterEach(configAction: Action<in T>)
Applies the given action to each item in the collection, as each item is required.
abstract fun <S> afterEach(type: Class<S>, configAction: Action<in S>)
Applies the given action to each item of the given type in the collection, as each item is required.
afterEach
Link copied to clipboard
@Incubating
inline fun <S : Any, T : Any> ModelMap<T>.afterEach(type: KClass<S>, configAction: Action<in S>)

Kotlin extension function taking kotlin.reflect.KClass for org.gradle.model.ModelMap.afterEach.

all
Link copied to clipboard
abstract fun all(configAction: Action<in T>)
Applies the given action to each item in the collection, as each item is required.
beforeEach
Link copied to clipboard
abstract fun beforeEach(configAction: Action<in T>)
Applies the given action to each item in this collection, as each item is required.
abstract fun <S> beforeEach(type: Class<S>, configAction: Action<in S>)
Applies the given action to each item of the given type in this collection, as each item is required.
beforeEach
Link copied to clipboard
@Incubating
inline fun <S : Any, T : Any> ModelMap<T>.beforeEach(type: KClass<S>, configAction: Action<in S>)

Kotlin extension function taking kotlin.reflect.KClass for org.gradle.model.ModelMap.beforeEach.

containsKey
Link copied to clipboard
abstract fun containsKey(name: Any): Boolean
Returns true if this collection contains an item with the given name.
containsValue
Link copied to clipboard
abstract fun containsValue(item: Any): Boolean
Returns true if this collection contains the given item.
create
Link copied to clipboard
abstract fun create(name: String)
abstract fun create(name: String, configAction: Action<in T>)
Defines an item with the given name and type T.
abstract fun <S : T?> create(name: String, type: Class<S>)
abstract fun <S : T?> create(name: String, type: Class<S>, configAction: Action<in S>)
Defines an item with the given name and type.
create
Link copied to clipboard
@Incubating
inline fun <S : T, T : Any> ModelMap<T>.create(name: String, type: KClass<S>)
@Incubating
inline fun <S : T, T : Any> ModelMap<T>.create(name: String, type: KClass<S>, configAction: Action<in S>)

Kotlin extension function taking kotlin.reflect.KClass for org.gradle.model.ModelMap.create.

forEach
Link copied to clipboard
open fun forEach(action: Consumer<in T>)
get
Link copied to clipboard
@Nullable
abstract fun get(name: Any): T
@Nullable
abstract fun get(name: String): T
Returns the item with the given name, if any.
getDisplayName
Link copied to clipboard
abstract fun getDisplayName(): String
getName
Link copied to clipboard
abstract fun getName(): String
isEmpty
Link copied to clipboard
abstract fun isEmpty(): Boolean
Returns true if this collection contains no items.
iterator
Link copied to clipboard
abstract fun iterator(): Iterator<T>
keySet
Link copied to clipboard
abstract fun keySet(): Set<String>
Returns the names of the items in this collection.
named
Link copied to clipboard
abstract fun named(name: String, ruleSource: Class<out RuleSource>)
Applies the given rule source class to the given item, when the item is required.
abstract fun named(name: String, configAction: Action<in T>)
Applies the given action to the given item, when the item is required.
named
Link copied to clipboard
@Incubating
inline fun <T : Any> ModelMap<T>.named(name: String, ruleSource: KClass<out RuleSource>)

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

put
Link copied to clipboard
abstract fun put(name: String, instance: T)
Adds an element to this `ModelMap`.
size
Link copied to clipboard
abstract fun size(): Int
Returns the number of items in this collection.
spliterator
Link copied to clipboard
open fun spliterator(): Spliterator<T>
values
Link copied to clipboard
abstract fun values(): Collection<T>
Returns the items in this collection.
withType
Link copied to clipboard
abstract fun <S> withType(type: Class<S>): ModelMap<S>
Returns a collection containing the items from this collection which are of the specified type.
abstract fun <S> withType(type: Class<S>, rules: Class<out RuleSource>)
Applies the given rules to all items of the collection of the given type.
abstract fun <S> withType(type: Class<S>, configAction: Action<in S>)
Applies the given action to each item of the given type in the collection, as each item is required.
withType
Link copied to clipboard
@Incubating
inline fun <S : Any, T : Any> ModelMap<T>.withType(type: KClass<S>): ModelMap<S>
@Incubating
inline fun <S : Any, T : Any> ModelMap<T>.withType(type: KClass<S>, rules: KClass<out RuleSource>)
@Incubating
inline fun <S : Any, T : Any> ModelMap<T>.withType(type: KClass<S>, configAction: Action<in S>)

Kotlin extension function taking kotlin.reflect.KClass for org.gradle.model.ModelMap.withType.