/** * Creates a {@link DocumentCondition} that has a {@link Condition#LIKE}, it means a select will scanning to a * document collection that has the same name and the value is like than informed in this document. * * @param document a column instance * @return a {@link DocumentCondition} with {@link Condition#LIKE} * @throws NullPointerException when column is null */ static DocumentCondition like(Document document) { return DefaultDocumentCondition.of(document, LIKE); }
@Override public PreparedStatement bind(String name, Object value) { preparedStatement.bind(name, value); return this; }
@Override public DocumentCondition negate() { if (NOT.equals(this.condition)) { return this.document.get(DocumentCondition.class); } else { Document document = Document.of(NOT.getNameField(), this); return new DefaultDocumentCondition(document, NOT); } }
static DocumentCondition in(Document document) { Objects.requireNonNull(document, "document is required"); Object value = document.get(); checkInClause(value); return new DefaultDocumentCondition(document, Condition.IN); }
static DocumentCondition between(Document document) { Objects.requireNonNull(document, "document is required"); checkBetweenClause(document.get()); return new DefaultDocumentCondition(document, Condition.BETWEEN); }
@Override public Document getDocument() { return condition.getDocument(); }
/** * Creates a {@link DocumentCondition} that has a {@link Condition#IN}, it means a select will scanning to a * document collection that has the same name and the value is within informed in this document. * * @param document a column instance * @return a {@link DocumentCondition} with {@link Condition#IN} * @throws NullPointerException when column is null */ static DocumentCondition in(Document document) { return DefaultDocumentCondition.in(document); }
/** * Creates a Document instance * * @param name - column's name * @param value - column's value * @return a Document instance * @see Documents */ static Document of(String name, Value value) { return new DefaultDocument(name, value); }
/** * It returns a {@link DocumentQueryParser} from {@link java.util.ServiceLoader} * * @return {@link DocumentQueryParser} instance * @throws IllegalStateException when there isn't DocumentQueryParser from service loader. */ static DocumentQueryParser getParser() { return DocumentQueryParserServiceLoader.getInstance(); }
@Override public PreparedStatementAsync bind(String name, Object value) { preparedStatementAsync.bind(name, value); return this; }
/** * It returns a {@link DocumentQueryParserAsync} from {@link java.util.ServiceLoader} * * @return {@link DocumentQueryParserAsync} instance * @throws IllegalStateException when there isn't DocumentQueryParser from service loader. */ static DocumentQueryParserAsync getParser() { return DocumentQueryParserServiceAsyncLoader.getInstance(); }
/** * Creates a {@link DocumentCondition} that has a {@link Condition#LESSER_THAN}, it means a select will scanning to a * document collection that has the same name and the value lesser than informed in this document. * * @param document a column instance * @return a {@link DocumentCondition} with {@link Condition#LESSER_THAN} * @throws NullPointerException when column is null */ static DocumentCondition lt(Document document) { return DefaultDocumentCondition.of(document, LESSER_THAN); }
/** * Creates a {@link DocumentCondition} that has a {@link Condition#EQUALS}, it means a select will scanning to a * document collection that has the same name and equals value informed in this document. * * @param document a column instance * @return a {@link DocumentCondition} with {@link Condition#EQUALS} * @throws NullPointerException when column is null */ static DocumentCondition eq(Document document) { return DefaultDocumentCondition.of(document, EQUALS); }
/** * Creates a {@link DocumentCondition} that has a {@link Condition#GREATER_THAN}, * it means a select will scanning to a document collection that has the same name and the value * greater than informed in this document. * * @param document a column instance * @return a {@link DocumentCondition} with {@link Condition#GREATER_THAN} * @throws NullPointerException when column is null */ static DocumentCondition gt(Document document) { return DefaultDocumentCondition.of(document, GREATER_THAN); }
/** * Creates a {@link DocumentCondition} that has a {@link Condition#GREATER_EQUALS_THAN}, * it means a select will scanning to a document collection that has the same name and the value * greater or equals than informed in this document. * * @param document a column instance * @return a {@link DocumentCondition} with {@link Condition#GREATER_EQUALS_THAN} * @throws NullPointerException when column is null */ static DocumentCondition gte(Document document) { return DefaultDocumentCondition.of(document, GREATER_EQUALS_THAN); }
/** * Creates a {@link DocumentCondition} that has a {@link Condition#LESSER_EQUALS_THAN}, * it means a select will scanning to a document collection that has the same name and the value * lesser or equals than informed in this document. * * @param document a document instance * @return a {@link DocumentCondition} with {@link Condition#LESSER_EQUALS_THAN} * @throws NullPointerException when column is null */ static DocumentCondition lte(Document document) { return DefaultDocumentCondition.of(document, LESSER_EQUALS_THAN); }