Package io.quarkus.builder
Class BuildContext
java.lang.Object
io.quarkus.builder.BuildContext
The context passed to a deployer's operation.
- Author:
- David M. Lloyd
-
Constructor Summary
ConstructorsConstructorDescriptionBuildContext(ClassLoader classLoader, StepInfo stepInfo, Execution execution) -
Method Summary
Modifier and TypeMethodDescription<T extends SimpleBuildItem>
TConsume the value produced for the named item.<T extends MultiBuildItem>
List<T> consumeMulti(Class<T> type) Consume all the values produced for the named item.<T extends MultiBuildItem>
List<T> consumeMulti(Class<T> type, Comparator<? super T> comparator) Consume all the values produced for the named item, re-sorting it according to the given comparator.(package private) voidvoidEmit a build error.Get the name of this build target.Get an executor which can be used for asynchronous tasks.voidEmit a build note.voidProduce the given item.<T extends BuildItem>
voidProduce the given item.voidproduce(List<? extends MultiBuildItem> items) Produce the given items.(package private) voidrun()voidEmit a build warning.
-
Constructor Details
-
BuildContext
BuildContext(ClassLoader classLoader, StepInfo stepInfo, Execution execution)
-
-
Method Details
-
getBuildTargetName
Get the name of this build target. The resultant string is useful for diagnostic messages and does not have any other significance.- Returns:
- the name of this build target (not
null)
-
produce
Produce the given item. If thetyperefers to an item which is declared with multiplicity, then this method can be called more than once for the giventype, otherwise it must be called no more than once.- Parameters:
item- the item value (must not benull)- Throws:
IllegalArgumentException- if the item does not allow multiplicity but this method is called more than one time, or if the type of item could not be determined
-
produce
Produce the given items. This method can be called more than once for the giventype- Parameters:
items- the items (must not benull)- Throws:
IllegalArgumentException- if the type of item could not be determined
-
produce
Produce the given item. If thetyperefers to an item which is declared with multiplicity, then this method can be called more than once for the giventype, otherwise it must be called no more than once.- Parameters:
type- the item type (must not benull)item- the item value (may benull)- Throws:
IllegalArgumentException- if this deployer was not declared to producetype, or iftypeisnull, or if the item does not allow multiplicity but this method is called more than one time
-
consume
Consume the value produced for the named item.- Parameters:
type- the item type (must not benull)- Returns:
- the produced item (may be
null) - Throws:
IllegalArgumentException- if this deployer was not declared to consumetype, or iftypeisnullClassCastException- if the cast failed
-
consumeMulti
Consume all the values produced for the named item. If the item type implementsComparable, it will be sorted by natural order before return. The returned list is a mutable copy.- Parameters:
type- the item element type (must not benull)- Returns:
- the produced items (may be empty, will not be
null) - Throws:
IllegalArgumentException- if this deployer was not declared to consumetype, or iftypeisnull
-
consumeMulti
public <T extends MultiBuildItem> List<T> consumeMulti(Class<T> type, Comparator<? super T> comparator) Consume all the values produced for the named item, re-sorting it according to the given comparator. The returned list is a mutable copy.- Parameters:
type- the item element type (must not benull)comparator- the comparator to use (must not benull)- Returns:
- the produced items (may be empty, will not be
null) - Throws:
IllegalArgumentException- if this deployer was not declared to consumetype, or iftypeisnull
-
note
Emit a build note. This indicates information that the user may be interested in.- Parameters:
location- the location of interest (may benull)format- the format string (seeString.format(String, Object...))args- the format arguments
-
warn
Emit a build warning. This indicates a significant build problem that the user should be made aware of.- Parameters:
location- the location of interest (may benull)format- the format string (seeString.format(String, Object...))args- the format arguments
-
error
Emit a build error. This indicates a build problem that prevents the build from proceeding.- Parameters:
location- the location of interest (may benull)format- the format string (seeString.format(String, Object...))args- the format arguments
-
getExecutor
Get an executor which can be used for asynchronous tasks.- Returns:
- an executor which can be used for asynchronous tasks
-
depFinished
void depFinished() -
run
void run()
-