-
Notifications
You must be signed in to change notification settings - Fork 272
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Criteria. Separate ExpressionVisitor into Visitor and BiVisitor (with…
… payload) Not all users require payload with visitor pattern. Introduce a simpler visitor API
- Loading branch information
1 parent
2b08e69
commit ae11efa
Showing
12 changed files
with
91 additions
and
47 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
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
19 changes: 19 additions & 0 deletions
19
criteria/common/src/org/immutables/criteria/constraints/ExpressionBiVisitor.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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package org.immutables.criteria.constraints; | ||
|
||
import javax.annotation.Nullable; | ||
|
||
/** | ||
* Visitor which also accepts a payload. | ||
* | ||
* @param <V> visitor return type | ||
* @param <C> context type | ||
*/ | ||
public interface ExpressionBiVisitor<V, C> { | ||
|
||
V visit(Call call, @Nullable C context); | ||
|
||
V visit(Literal literal, @Nullable C context); | ||
|
||
V visit(Path path, @Nullable C context); | ||
|
||
} |
14 changes: 7 additions & 7 deletions
14
criteria/common/src/org/immutables/criteria/constraints/ExpressionVisitor.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,18 +1,18 @@ | ||
package org.immutables.criteria.constraints; | ||
|
||
import javax.annotation.Nullable; | ||
|
||
/** | ||
* Visitor pattern for traversing a tree of expressions. | ||
* | ||
* Consider using {@link ExpressionBiVisitor} if you need to propagate some context / payload. | ||
* | ||
* @param <V> visitor return type | ||
* @param <C> context type | ||
*/ | ||
public interface ExpressionVisitor<V, C> { | ||
public interface ExpressionVisitor<V> { | ||
|
||
V visit(Call call, @Nullable C context); | ||
V visit(Call call); | ||
|
||
V visit(Literal literal, @Nullable C context); | ||
V visit(Literal literal); | ||
|
||
V visit(Path path, @Nullable C context); | ||
V visit(Path path); | ||
|
||
} |
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
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
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