Skip to content

Commit

Permalink
Add GoalQuery to api (#987)
Browse files Browse the repository at this point in the history
Signed-off-by: KingSimon <[email protected]>
  • Loading branch information
KingOfSquares authored May 13, 2022
1 parent a200242 commit ea2bb37
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
8 changes: 8 additions & 0 deletions core/src/main/java/tc/oc/pgm/api/filter/query/GoalQuery.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package tc.oc.pgm.api.filter.query;

import tc.oc.pgm.goals.Goal;
import tc.oc.pgm.goals.GoalDefinition;

public interface GoalQuery<T extends GoalDefinition> extends MatchQuery {
Goal<T> getGoal();
}
13 changes: 8 additions & 5 deletions core/src/main/java/tc/oc/pgm/filters/query/GoalQuery.java
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
package tc.oc.pgm.filters.query;

import tc.oc.pgm.goals.Goal;
import tc.oc.pgm.goals.GoalDefinition;

/**
* Currently, the only thing this class does is derive the Match from a Goal. In the future, we may
* have filters that respond specifically to goal queries, but currently we do not.
*/
public class GoalQuery extends MatchQuery {
private final Goal<?> goal;
public class GoalQuery<T extends GoalDefinition> extends MatchQuery
implements tc.oc.pgm.api.filter.query.GoalQuery<T> {
private final Goal<T> goal;

public GoalQuery(Goal<?> goal) {
public GoalQuery(Goal<T> goal) {
super(null, goal.getMatch());
this.goal = goal;
}

public Goal<?> getGoal() {
return goal;
@Override
public Goal<T> getGoal() {
return this.goal;
}
}

0 comments on commit ea2bb37

Please sign in to comment.