Skip to content

Commit

Permalink
source clean
Browse files Browse the repository at this point in the history
  • Loading branch information
nicol authored and nicol committed Sep 25, 2023
1 parent 8daf875 commit 4419591
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 11 deletions.
11 changes: 2 additions & 9 deletions src/main/java/org/magic/api/criterias/MTGCrit.java
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package org.magic.api.criterias;

import java.util.Arrays;
import java.util.List;


public class MTGCrit<T> {

private String att;
private OPERATOR operator;
private T[] val;

public enum OPERATOR { EQ,START_WITH,END_WITH, LIKE,GREATER,LOWER,GREATER_EQ,LOWER_EQ, IN }
public enum OPERATOR { EQ,START_WITH,END_WITH, LIKE,GREATER,LOWER,GREATER_EQ,LOWER_EQ, IN, NOT }

@SafeVarargs
public MTGCrit(String att, OPERATOR operator, T... val) {
Expand Down Expand Up @@ -64,13 +64,6 @@ public boolean isList()
return val.length>1;
}

public List<T> toList()
{
return Arrays.asList(val);
}



@Override
public String toString() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public Filter build(MTGCrit<?>... crits) {
case LOWER_EQ:l.add(where(c.getAtt()).lte(getValueFor(c.getFirst())));break;
case START_WITH:break;
case IN:l.add(where(c.getAtt()).in(getValueFor(c.getVal())));break;
case NOT:l.add(where(c.getAtt()).noneof(getValueFor(c.getVal())));break;
case END_WITH :break;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ public Query build(MTGCrit<?>... crits)
case GREATER_EQ : ((SelectWhereStep<Record3<Object, Object, Object>>) query).where(field(c.getAtt()).greaterOrEqual(getValueFor(c.getFirst())));break;
case LOWER_EQ : ((SelectWhereStep<Record3<Object, Object, Object>>) query).where(field(c.getAtt()).lessOrEqual(getValueFor(c.getFirst())));break;
case IN: ((SelectWhereStep<Record3<Object, Object, Object>>) query).where(field(c.getAtt()).in(getValueFor(c.getVal())));break;
case NOT: ((SelectWhereStep<Record3<Object, Object, Object>>) query).where(field(c.getAtt()).notEqual(getValueFor(c.getVal())));break;
}
}
}

return query;
return query;
}


Expand Down

0 comments on commit 4419591

Please sign in to comment.