T
- type of the elements in this container.@Incubating public interface BinaryCollection<T extends SoftwareComponent>
Each element in this collection passes through several states. The element is created and becomes 'known'. The element is passed to any actions registered using whenElementKnown(Action)
. The element is then configured using any actions registered using configureEach(Action)
and becomes 'finalized'. The element is passed to any actions registered using whenElementFinalized(Action)
. Elements are created and configured only when required.
Modifier and Type | Method | Description |
---|---|---|
<S> void |
configureEach(Class<S> type,
Action<? super S> action) |
Registers an action to execute to configure each element of the given type in the collection.
|
void |
configureEach(Action<? super T> action) |
Registers an action to execute to configure each element in the collection.
|
Set<T> |
get() |
Returns the set of binaries from this collection.
|
<S> BinaryProvider<S> |
get(Class<S> type,
Spec<? super S> spec) |
Returns a
BinaryProvider that contains the single binary matching the specified type and specification. |
BinaryProvider<T> |
get(Spec<? super T> spec) |
Returns a
Provider that contains the single binary matching the given specification. |
BinaryProvider<T> |
getByName(String name) |
Returns a
BinaryProvider that contains the single binary with the given name. |
<S> void |
whenElementFinalized(Class<S> type,
Action<? super S> action) |
Registers an action to execute when an element of the given type is finalized.
|
void |
whenElementFinalized(Action<? super T> action) |
Registers an action to execute when an element is finalized.
|
<S> void |
whenElementKnown(Class<S> type,
Action<? super S> action) |
Registers an action to execute when an element of the given type becomes known.
|
void |
whenElementKnown(Action<? super T> action) |
Registers an action to execute when an element becomes known.
|
<S> BinaryProvider<S> get(Class<S> type, Spec<? super S> spec)
BinaryProvider
that contains the single binary matching the specified type and specification. The binary will be in the finalized state. The provider can be used to apply configuration to the element before it is finalized.
Querying the return value will fail when there is not exactly one matching binary.
S
- type of the binary to returntype
- type to matchspec
- specification to satisfy. The spec is applied to each binary prior to configuration.BinaryProvider<T> getByName(String name)
BinaryProvider
that contains the single binary with the given name. The binary will be in the finalized state. The provider can be used to apply configuration to the element before it is finalized.
Querying the return value will fail when there is not exactly one matching binary.
name
- The name of the binaryBinaryProvider<T> get(Spec<? super T> spec)
Provider
that contains the single binary matching the given specification. The binary will be in the finalized state. The provider can be used to apply configuration to the element before it is finalized.
Querying the return value will fail when there is not exactly one matching binary.
spec
- specification to satisfy. The spec is applied to each binary prior to configuration.void whenElementKnown(Action<? super T> action)
action
- The action to execute for each element becomes known.<S> void whenElementKnown(Class<S> type, Action<? super S> action)
type
- The type of element to select.action
- The action to execute for each element becomes known.void whenElementFinalized(Action<? super T> action)
action
- The action to execute for each element when finalized.<S> void whenElementFinalized(Class<S> type, Action<? super S> action)
type
- The type of element to select.action
- The action to execute for each element when finalized.void configureEach(Action<? super T> action)
action
- The action to execute on each element for configuration.<S> void configureEach(Class<S> type, Action<? super S> action)
type
- The type of element to select.action
- The action to execute on each element for configuration.