-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9cc331d
commit cb8d2c0
Showing
3 changed files
with
16 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 14 additions & 38 deletions
52
core/builder/src/main/java/io/quarkus/builder/Consume.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,20 @@ | ||
package io.quarkus.builder; | ||
|
||
/** | ||
*/ | ||
final class Consume { | ||
private final BuildStepBuilder buildStepBuilder; | ||
private final ItemId itemId; | ||
private final Constraint constraint; | ||
private final ConsumeFlags flags; | ||
import static io.quarkus.builder.Constraint.ORDER_ONLY; | ||
import static io.quarkus.builder.Constraint.REAL; | ||
import static io.quarkus.builder.ConsumeFlag.OPTIONAL; | ||
|
||
Consume(final BuildStepBuilder buildStepBuilder, final ItemId itemId, final Constraint constraint, | ||
final ConsumeFlags flags) { | ||
this.buildStepBuilder = buildStepBuilder; | ||
this.itemId = itemId; | ||
this.constraint = constraint; | ||
this.flags = flags; | ||
} | ||
|
||
BuildStepBuilder getBuildStepBuilder() { | ||
return buildStepBuilder; | ||
} | ||
|
||
ItemId getItemId() { | ||
return itemId; | ||
} | ||
|
||
ConsumeFlags getFlags() { | ||
return flags; | ||
} | ||
|
||
Consume combine(final Constraint constraint, final ConsumeFlags flags) { | ||
final Constraint outputConstraint = constraint == Constraint.REAL || this.constraint == Constraint.REAL | ||
? Constraint.REAL | ||
: Constraint.ORDER_ONLY; | ||
final ConsumeFlags outputFlags = !flags.contains(ConsumeFlag.OPTIONAL) || !this.flags.contains(ConsumeFlag.OPTIONAL) | ||
? flags.with(this.flags).without(ConsumeFlag.OPTIONAL) | ||
: flags.with(this.flags); | ||
return new Consume(buildStepBuilder, itemId, outputConstraint, outputFlags); | ||
} | ||
public record Consume(BuildStepBuilder buildStepBuilder, ItemId itemId, Constraint constraint, ConsumeFlags flags) { | ||
|
||
Constraint getConstraint() { | ||
return constraint; | ||
public Consume combine(final Constraint constraint, final ConsumeFlags flags) { | ||
return new Consume( | ||
buildStepBuilder, | ||
itemId, | ||
constraint == REAL || this.constraint == REAL | ||
? REAL | ||
: ORDER_ONLY, | ||
!flags.contains(OPTIONAL) || !this.flags.contains(OPTIONAL) | ||
? flags.with(this.flags).without(OPTIONAL) | ||
: flags.with(this.flags)); | ||
} | ||
} |