A PolymorphicDomainObjectContainer that can be extended at runtime to create elements of new types.
- the (base) container element typeType | Name and description |
---|---|
void |
registerBinding(Class<U> type, Class<? extends U> implementationType) Registers a binding from the specified "public" domain object type to the specified implementation type. |
void |
registerFactory(Class<U> type, NamedDomainObjectFactory<? extends U> factory) Registers a factory for creating elements of the specified type. |
void |
registerFactory(Class<U> type, Closure<? extends U> factory) Registers a factory for creating elements of the specified type. |
Methods inherited from class | Name |
---|---|
interface PolymorphicDomainObjectContainer |
containerWithType, create, create, maybeCreate |
interface NamedDomainObjectContainer |
configure, create, create, create, maybeCreate |
interface NamedDomainObjectSet |
findAll, matching, matching, withType |
interface NamedDomainObjectCollection |
add, addAll, addRule, addRule, findByName, getAsMap, getAt, getByName, getByName, getNamer, getNames, getRules, matching, matching, withType |
interface Set |
add, equals, hashCode, clear, contains, isEmpty, size, toArray, toArray, addAll, iterator, remove, containsAll, removeAll, retainAll |
Registers a binding from the specified "public" domain object type to the specified implementation type. Whenever the container is asked to create an element with the binding's public type, it will instantiate the binding's implementation type. If the implementation type has a constructor annotated with javax.inject.Inject, its arguments will be injected.
In general, registering a binding is preferable over implementing and registering a factory.
type
- a public domain object typeimplementationType
- the corresponding implementation type
- a public domain object typeRegisters a factory for creating elements of the specified type. Typically, the specified type is an interface type.
type
- the type of objects created by the factoryfactory
- the factory to register
- the type of objects created by the factoryRegisters a factory for creating elements of the specified type. Typically, the specified type is an interface type.
type
- the type of objects created by the factoryfactory
- the factory to register
- the type of objects created by the factory