T - the (base) type of domain objects in the containerCollection<T>, org.gradle.util.Configurable<NamedDomainObjectContainer<T>>, DomainObjectCollection<T>, Iterable<T>, NamedDomainObjectCollection<T>, NamedDomainObjectContainer<T>, NamedDomainObjectSet<T>, Set<T>AuthenticationContainer, ExtensiblePolymorphicDomainObjectContainer<T>, NativeToolChainRegistry, PlatformContainer, PlayDistributionContainer, PublicationContainer, Repositories, TaskContainer@Incubating public interface PolymorphicDomainObjectContainer<T> extends NamedDomainObjectContainer<T>
NamedDomainObjectContainer that allows to create domain objects with different types.| Modifier and Type | Method | Description |
|---|---|---|
<U extends T> |
containerWithType(Class<U> type) |
Creates a regular container that wraps the polymorphic container presenting all elements of a specified type.
|
<U extends T> |
create(String name,
Class<U> type) |
Creates a domain object with the specified name and type, and adds it to the container.
|
<U extends T> |
create(String name,
Class<U> type,
Action<? super U> configuration) |
Creates a domain object with the specified name and type, adds it to the container, and configures
it with the specified action.
|
<U extends T> |
maybeCreate(String name,
Class<U> type) |
Looks for an item with the given name and type, creating and adding it to this container if it does not exist.
|
clear, contains, containsAll, equals, hashCode, isEmpty, iterator, parallelStream, remove, removeAll, removeIf, retainAll, size, spliterator, stream, toArray, toArrayall, all, whenObjectAdded, whenObjectAdded, whenObjectRemoved, whenObjectRemoved, withType, withTypeadd, addAll, addRule, addRule, addRule, findByName, getAsMap, getAt, getByName, getByName, getByName, getNamer, getNames, getRulesconfigure, create, create, create, maybeCreatefindAll, matching, matching, withType<U extends T> U create(String name, Class<U> type) throws InvalidUserDataException
U - the type of the domain object to be createdname - the name of the domain object to be createdtype - the type of the domain object to be createdInvalidUserDataException - if a domain object with the specified name already exists
or the container does not support creating a domain object with the specified type<U extends T> U maybeCreate(String name, Class<U> type) throws InvalidUserDataException
U - the type of the domain object to be createdname - the name of the domain object to be createdtype - the type of the domain object to be creatednull.InvalidUserDataException - if the container does not support creating a domain object with the specified typeClassCastException - if a domain object with the specified name exists with a different type<U extends T> U create(String name, Class<U> type, Action<? super U> configuration) throws InvalidUserDataException
U - the type of the domain object to be createdname - the name of the domain object to be createdtype - the type of the domain object to be createdconfiguration - an action for configuring the domain objectInvalidUserDataException - if a domain object with the specified name already exists
or the container does not support creating a domain object with the specified type<U extends T> NamedDomainObjectContainer<U> containerWithType(Class<U> type)
U - the type of the container elementstype - the type of the container elementsNamedDomainObjectContainer providing access to elements of type U.