Package org.gradle.language
Interface BinaryCollection<T extends SoftwareComponent>
- Type Parameters:
T
- type of the elements in this container.
public interface BinaryCollection<T extends SoftwareComponent>
A collection of binaries that are created and configured as they are required.
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.
- Since:
- 4.5
-
Method Summary
Modifier and TypeMethodDescription<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.get()
Returns the set of binaries from this collection.<S> BinaryProvider<S>
Returns aBinaryProvider
that contains the single binary matching the specified type and specification.Returns aProvider
that contains the single binary matching the given specification.Returns aBinaryProvider
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.
-
Method Details
-
get
Returns aBinaryProvider
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.
- Type Parameters:
S
- type of the binary to return- Parameters:
type
- type to matchspec
- specification to satisfy. The spec is applied to each binary prior to configuration.- Returns:
- a binary from the collection in a finalized state
-
getByName
Returns aBinaryProvider
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.
- Parameters:
name
- The name of the binary- Returns:
- a binary from the collection in a finalized state
-
get
Returns aProvider
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.
- Parameters:
spec
- specification to satisfy. The spec is applied to each binary prior to configuration.- Returns:
- a binary from the collection in a finalized state
-
whenElementKnown
Registers an action to execute when an element becomes known. The action is only executed for those elements that are required. Fails if any element has already been finalized.- Parameters:
action
- The action to execute for each element becomes known.
-
whenElementKnown
Registers an action to execute when an element of the given type becomes known. The action is only executed for those elements that are required. Fails if any matching element has already been finalized.- Parameters:
type
- The type of element to select.action
- The action to execute for each element becomes known.
-
whenElementFinalized
Registers an action to execute when an element is finalized. The action is only executed for those elements that are required. Fails if any element has already been finalized.- Parameters:
action
- The action to execute for each element when finalized.
-
whenElementFinalized
Registers an action to execute when an element of the given type is finalized. The action is only executed for those elements that are required. Fails if any matching element has already been finalized.- Parameters:
type
- The type of element to select.action
- The action to execute for each element when finalized.
-
configureEach
Registers an action to execute to configure each element in the collection. The action is only executed for those elements that are required. Fails if any element has already been finalized.- Parameters:
action
- The action to execute on each element for configuration.
-
configureEach
Registers an action to execute to configure each element of the given type in the collection. The action is only executed for those elements that are required. Fails if any matching element has already been finalized.- Parameters:
type
- The type of element to select.action
- The action to execute on each element for configuration.
-
get
Returns the set of binaries from this collection. Elements are in a finalized state.
-