Skip to content

Commit

Permalink
returns firevalue
Browse files Browse the repository at this point in the history
  • Loading branch information
otaviojava committed Jun 15, 2018
1 parent 3597875 commit 048a92f
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,4 @@ default String fireField(String entity, String field) {
return field;
}

/**
* Fire an event to each field value in the field
*
* @param entity the entity
* @param field the field
* @param value the value
* @return the converted value
* @throws NullPointerException when there is null parameter
*/
default Object fireValue(String entity, String field, Object value) {
return value;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,22 +50,22 @@ static ColumnCondition getCondition(Condition condition, Params parameters, Colu
switch (condition.getOperator()) {
case EQUALS:
return eq(Column.of(getName(condition, observer, entity),
getValue(condition, parameters, observer, entity)));
Values.get(condition.getValue(), parameters)));
case GREATER_THAN:
return gt(Column.of(getName(condition, observer, entity),
getValue(condition, parameters, observer, entity)));
Values.get(condition.getValue(), parameters)));
case GREATER_EQUALS_THAN:
return gte(Column.of(getName(condition, observer, entity),
getValue(condition, parameters, observer, entity)));
Values.get(condition.getValue(), parameters)));
case LESSER_THAN:
return lt(Column.of(getName(condition, observer, entity),
getValue(condition, parameters, observer, entity)));
Values.get(condition.getValue(), parameters)));
case LESSER_EQUALS_THAN:
return lte(Column.of(getName(condition, observer, entity),
getValue(condition, parameters, observer, entity)));
Values.get(condition.getValue(), parameters)));
case IN:
return in(Column.of(getName(condition, observer, entity),
getValue(condition, parameters, observer, entity)));
Values.get(condition.getValue(), parameters)));
case LIKE:
return like(Column.of(getName(condition, observer, entity),
Values.get(condition.getValue(),
Expand Down Expand Up @@ -99,8 +99,4 @@ private static String getName(Condition condition, ColumnObserverParser observer
return observer.fireField(entity, condition.getName());
}

private static Object getValue(Condition condition, Params parameters,
ColumnObserverParser observer, String entity) {
return observer.fireValue(entity, condition.getName(), Values.get(condition.getValue(), parameters));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,5 @@ default String fireField(String entity, String document) {
return document;
}

/**
* Fire an event to each field value in the field
*
* @param entity the entity
* @param field the field
* @param value the value
* @return the converted value
* @throws NullPointerException when there is null parameter
*/
default Object fireValue(String entity, String field, Object value) {
return value;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -49,28 +49,28 @@ static DocumentCondition getCondition(Condition condition, Params parameters, Do
switch (condition.getOperator()) {
case EQUALS:
return eq(Document.of(getName(condition, observer, entity),
getValue(condition, parameters, observer, entity)));
Values.get(condition.getValue(), parameters)));
case GREATER_THAN:
return gt(Document.of(getName(condition, observer, entity),
getValue(condition, parameters, observer, entity)));
Values.get(condition.getValue(), parameters)));
case GREATER_EQUALS_THAN:
return gte(Document.of(getName(condition, observer, entity),
getValue(condition, parameters, observer, entity)));
Values.get(condition.getValue(), parameters)));
case LESSER_THAN:
return lt(Document.of(getName(condition, observer, entity),
getValue(condition, parameters, observer, entity)));
Values.get(condition.getValue(), parameters)));
case LESSER_EQUALS_THAN:
return lte(Document.of(getName(condition, observer, entity),
getValue(condition, parameters, observer, entity)));
Values.get(condition.getValue(), parameters)));
case IN:
return in(Document.of(getName(condition, observer, entity),
getValue(condition, parameters, observer, entity)));
Values.get(condition.getValue(), parameters)));
case LIKE:
return like(Document.of(getName(condition, observer, entity),
getValue(condition, parameters, observer, entity)));
Values.get(condition.getValue(), parameters)));
case BETWEEN:
return between(Document.of(getName(condition, observer, entity),
getValue(condition, parameters, observer, entity)));
Values.get(condition.getValue(), parameters)));
case NOT:
return getCondition(ConditionValue.class.cast(condition.getValue()).get().get(0),
parameters, observer,
Expand All @@ -92,11 +92,6 @@ static DocumentCondition getCondition(Condition condition, Params parameters, Do
}
}

private static Object getValue(Condition condition, Params parameters,
DocumentObserverParser observer, String entity) {
return observer.fireValue(entity, condition.getName(), Values.get(condition.getValue(), parameters));
}

private static String getName(Condition condition,
DocumentObserverParser observer, String entity) {
return observer.fireField(entity, condition.getName());
Expand Down

0 comments on commit 048a92f

Please sign in to comment.