diff --git a/diana-column/src/main/java/org/jnosql/diana/api/column/ColumnObserverParser.java b/diana-column/src/main/java/org/jnosql/diana/api/column/ColumnObserverParser.java index e511cbc2d..80666865c 100644 --- a/diana-column/src/main/java/org/jnosql/diana/api/column/ColumnObserverParser.java +++ b/diana-column/src/main/java/org/jnosql/diana/api/column/ColumnObserverParser.java @@ -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; - } } \ No newline at end of file diff --git a/diana-column/src/main/java/org/jnosql/diana/api/column/query/Conditions.java b/diana-column/src/main/java/org/jnosql/diana/api/column/query/Conditions.java index 2296c39a6..7e07c3673 100644 --- a/diana-column/src/main/java/org/jnosql/diana/api/column/query/Conditions.java +++ b/diana-column/src/main/java/org/jnosql/diana/api/column/query/Conditions.java @@ -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(), @@ -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)); - } } diff --git a/diana-document/src/main/java/org/jnosql/diana/api/document/DocumentObserverParser.java b/diana-document/src/main/java/org/jnosql/diana/api/document/DocumentObserverParser.java index bdea798fb..2f40d1429 100644 --- a/diana-document/src/main/java/org/jnosql/diana/api/document/DocumentObserverParser.java +++ b/diana-document/src/main/java/org/jnosql/diana/api/document/DocumentObserverParser.java @@ -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; - } } diff --git a/diana-document/src/main/java/org/jnosql/diana/api/document/query/Conditions.java b/diana-document/src/main/java/org/jnosql/diana/api/document/query/Conditions.java index 1db34063f..c5274fd2a 100644 --- a/diana-document/src/main/java/org/jnosql/diana/api/document/query/Conditions.java +++ b/diana-document/src/main/java/org/jnosql/diana/api/document/query/Conditions.java @@ -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, @@ -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());