T
- the (base) type of domain objects in the container@Incubating public interface PolymorphicDomainObjectContainer<T> extends NamedDomainObjectContainer<T>
NamedDomainObjectContainer
that allows to create domain objects with different types.Modifier and Type | Method and 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.
|
configure, create, create, create, maybeCreate
findAll, matching, matching, withType
add, addAll, addRule, addRule, findByName, getAsMap, getAt, getByName, getByName, getNamer, getNames, getRules
all, all, whenObjectAdded, whenObjectAdded, whenObjectRemoved, whenObjectRemoved, withType, 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@Incubating <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.