public abstract class BsonQuery extends Query
A base class for Query implementations that create BSON queries based on MongoDB query format. See https://docs.mongodb.com/manual/tutorial/query-documents/
Modifiers | Name | Description |
---|---|---|
protected interface |
BsonQuery.OperatorHandler |
Handles query operators when reading BSON |
protected interface |
BsonQuery.ProjectionHandler |
Handles a projection |
protected interface |
BsonQuery.QueryHandler |
Handles an individual criterion |
Modifiers | Name | Description |
---|---|---|
static java.lang.String |
AND_OPERATOR |
|
static java.lang.String |
AVERAGE_OPERATOR |
|
static org.bson.codecs.EncoderContext |
ENCODER_CONTEXT |
|
static java.lang.String |
EQ_OPERATOR |
|
static java.lang.String |
EXISTS_OPERATOR |
|
static java.lang.String |
GROUP_OPERATOR |
|
static java.lang.String |
GTE_OPERATOR |
|
static java.lang.String |
GT_OPERATOR |
|
static java.lang.String |
ID_REFERENCE_SUFFIX |
|
static java.lang.String |
IN_OPERATOR |
|
static java.lang.String |
LTE_OPERATOR |
|
static java.lang.String |
LT_OPERATOR |
|
static java.lang.String |
MATCH_OPERATOR |
|
static java.lang.String |
MAX_OPERATOR |
|
static java.lang.String |
MIN_OPERATOR |
|
static java.lang.String |
NE_OPERATOR |
|
static java.lang.String |
NIN_OPERATOR |
|
static java.lang.String |
NOR_OPERATOR |
|
static java.lang.String |
NOT_OPERATOR |
|
static java.lang.String |
OR_OPERATOR |
|
static java.lang.String |
PROJECT_OPERATOR |
|
static java.lang.String |
REGEX_OPERATOR |
|
static java.lang.String |
SIZE_OPERATOR |
|
static java.lang.String |
SORT_OPERATOR |
|
static java.lang.String |
SUM_OPERATOR |
|
private static java.lang.String |
THIS_PREFIX |
|
static java.lang.String |
WHERE_OPERATOR |
|
protected static java.util.Map<java.lang.Class, ProjectionHandler> |
groupByProjectionHandlers |
|
protected static java.util.Map<java.lang.String, OperatorHandler> |
operatorHandlers |
|
protected static java.util.Map<java.lang.Class, ProjectionHandler> |
projectProjectionHandlers |
|
protected static java.util.Map<java.lang.Class, QueryHandler> |
queryHandlers |
Fields inherited from class | Fields |
---|---|
class Query |
criteria, entity, fetchStrategies, joinTypes, lockResult, max, offset, orderBy, projections, queryCache, session, uniqueResult |
Constructor and description |
---|
protected BsonQuery
(Session session, PersistentEntity entity) |
protected BsonQuery
(PersistentEntity entity) |
Type Params | Return Type | Name and description |
---|---|---|
|
private static void |
addWherePropertyComparison(org.bson.Document query, java.lang.String propertyName, java.lang.String otherPropertyName, java.lang.String operator) |
|
public static org.bson.Document |
createBsonQuery(org.bson.codecs.configuration.CodecRegistry registry, PersistentEntity entity, java.util.List<Criterion> criteria) Creates a new query for the given registry, entity and criteria |
|
public static org.bson.Document |
createBsonQuery(org.bson.codecs.configuration.CodecRegistry registry, PersistentEntity entity, Junction junction) Creates a new query for the given registry, entity and criteria |
|
protected static java.util.List<java.lang.Object> |
getInListQueryValues(PersistentEntity entity, In in) Get the list of native values to use in the query. |
|
private static java.lang.Integer |
getNumber(PropertyCriterion criterion) |
|
protected static org.bson.Document |
getOrCreatePropertyQuery(org.bson.Document query, java.lang.String propertyName) |
|
protected static java.lang.String |
getPropertyName(PersistentEntity entity, PropertyNameCriterion criterion) |
|
protected static java.lang.String |
getPropertyName(PersistentEntity entity, java.lang.String propertyName) |
|
public void |
handle(EmbeddedQueryEncoder queryEncoder, IdEquals criterion, org.bson.Document query, PersistentEntity entity) |
|
public void |
handle(EmbeddedQueryEncoder queryEncoder, Equals criterion, org.bson.Document query, PersistentEntity entity) |
|
public void |
handle(EmbeddedQueryEncoder queryEncoder, IsNull criterion, org.bson.Document query, PersistentEntity entity) |
|
public void |
handle(EmbeddedQueryEncoder queryEncoder, IsNotNull criterion, org.bson.Document query, PersistentEntity entity) |
|
public void |
handle(EmbeddedQueryEncoder queryEncoder, EqualsProperty criterion, org.bson.Document query, PersistentEntity entity) |
|
public void |
handle(EmbeddedQueryEncoder queryEncoder, NotEqualsProperty criterion, org.bson.Document query, PersistentEntity entity) |
|
public void |
handle(EmbeddedQueryEncoder queryEncoder, GreaterThanProperty criterion, org.bson.Document query, PersistentEntity entity) |
|
public void |
handle(EmbeddedQueryEncoder queryEncoder, LessThanProperty criterion, org.bson.Document query, PersistentEntity entity) |
|
public void |
handle(EmbeddedQueryEncoder queryEncoder, GreaterThanEqualsProperty criterion, org.bson.Document query, PersistentEntity entity) |
|
public void |
handle(EmbeddedQueryEncoder queryEncoder, LessThanEqualsProperty criterion, org.bson.Document query, PersistentEntity entity) |
|
public void |
handle(EmbeddedQueryEncoder queryEncoder, NotEquals criterion, org.bson.Document query, PersistentEntity entity) |
|
public void |
handle(EmbeddedQueryEncoder queryEncoder, Like like, org.bson.Document query, PersistentEntity entity) |
|
public void |
handle(EmbeddedQueryEncoder queryEncoder, ILike like, org.bson.Document query, PersistentEntity entity) |
|
public void |
handle(EmbeddedQueryEncoder queryEncoder, RLike like, org.bson.Document query, PersistentEntity entity) |
|
public void |
handle(EmbeddedQueryEncoder queryEncoder, In in, org.bson.Document query, PersistentEntity entity) |
|
public void |
handle(EmbeddedQueryEncoder queryEncoder, Between between, org.bson.Document query, PersistentEntity entity) |
|
public void |
handle(EmbeddedQueryEncoder queryEncoder, GreaterThan criterion, org.bson.Document query, PersistentEntity entity) |
|
public void |
handle(EmbeddedQueryEncoder queryEncoder, GreaterThanEquals criterion, org.bson.Document query, PersistentEntity entity) |
|
public void |
handle(EmbeddedQueryEncoder queryEncoder, LessThan criterion, org.bson.Document query, PersistentEntity entity) |
|
public void |
handle(EmbeddedQueryEncoder queryEncoder, LessThanEquals criterion, org.bson.Document query, PersistentEntity entity) |
|
public void |
handle(EmbeddedQueryEncoder queryEncoder, Conjunction criterion, org.bson.Document query, PersistentEntity entity) |
|
public void |
handle(EmbeddedQueryEncoder queryEncoder, Negation criteria, org.bson.Document query, PersistentEntity entity) |
|
public void |
handle(EmbeddedQueryEncoder queryEncoder, Disjunction criterion, org.bson.Document query, PersistentEntity entity) |
|
public void |
handle(EmbeddedQueryEncoder queryEncoder, SizeEquals criterion, org.bson.Document query, PersistentEntity entity) |
|
public void |
handle(EmbeddedQueryEncoder queryEncoder, SizeNotEquals criterion, org.bson.Document query, PersistentEntity entity) |
|
public void |
handle(EmbeddedQueryEncoder queryEncoder, SizeGreaterThan criterion, org.bson.Document query, PersistentEntity entity) |
|
public void |
handle(EmbeddedQueryEncoder queryEncoder, SizeLessThan criterion, org.bson.Document query, PersistentEntity entity) |
|
public void |
handle(EmbeddedQueryEncoder queryEncoder, SizeLessThanEquals criterion, org.bson.Document query, PersistentEntity entity) |
|
public void |
handle(EmbeddedQueryEncoder queryEncoder, SizeGreaterThanEquals criterion, org.bson.Document query, PersistentEntity entity) |
|
public void |
handle(Junction criteria, java.lang.String attributeName, org.bson.BsonReader queryReader) |
|
public void |
handle(Junction criteria, java.lang.String attributeName, org.bson.BsonReader queryReader) |
|
public void |
handle(Junction criteria, java.lang.String attributeName, org.bson.BsonReader queryReader) |
|
public void |
handle(Junction criteria, java.lang.String attributeName, org.bson.BsonReader queryReader) |
|
public void |
handle(Junction criteria, java.lang.String attributeName, org.bson.BsonReader queryReader) |
|
public void |
handle(Junction criteria, java.lang.String attributeName, org.bson.BsonReader queryReader) |
|
public void |
handle(Junction criteria, java.lang.String attributeName, org.bson.BsonReader queryReader) |
|
public void |
handle(Junction criteria, java.lang.String attributeName, org.bson.BsonReader queryReader) |
|
public void |
handle(Junction criteria, java.lang.String attributeName, org.bson.BsonReader queryReader) |
|
public void |
handle(Junction criteria, java.lang.String attributeName, org.bson.BsonReader queryReader) |
|
public void |
handle(Junction criteria, java.lang.String attributeName, org.bson.BsonReader queryReader) |
|
public void |
handle(Junction criteria, java.lang.String attributeName, org.bson.BsonReader queryReader) |
|
private static void |
handleLike(PersistentEntity entity, Like like, org.bson.Document query, boolean caseSensitive) |
<T> |
public static DetachedCriteria<T> |
parse(java.lang.Class<T> type, org.bson.BsonReader queryReader) Parse a query from a BsonReader into a DetachedCriteria |
|
private static void |
parseJunctionDocuments(Junction junction, java.lang.String attributeName, org.bson.BsonReader queryReader, org.bson.BsonType bsonType) |
|
private static org.bson.BsonType |
parseQueryAttributeValue(org.bson.BsonReader queryReader, org.bson.BsonType bsonType, java.lang.String attributeName, Junction junction) |
|
protected static void |
populateBsonQuery(EmbeddedQueryEncoder queryEncoder, org.bson.Document query, java.util.List<Criterion> criteria, PersistentEntity entity) |
|
protected static void |
populateBsonQuery(EmbeddedQueryEncoder queryEncoder, org.bson.Document query, Junction criteria, PersistentEntity entity) |
|
private static java.util.List |
readArrayOfValues(org.bson.BsonReader queryReader) |
|
protected static java.lang.Object |
readBsonValue(org.bson.BsonReader queryReader, org.bson.BsonType bsonType) |
Methods inherited from class | Name |
---|---|
class Query |
add, add, addToJunction, allEq, and, between, cache, clone, conjunction, conjunction, createQuery, disjunction, disjunction, doList, eq, executeQuery, fetchStrategy, findInstanceId, firstResult, flushBeforeQuery, ge, getCriteria, getEntity, getOrderBy, getSession, gt, gte, idEq, ilike, in, isEmpty, isNotEmpty, isNotNull, isNull, join, join, le, like, list, lock, lock, lt, lte, max, maxResults, negation, negation, offset, or, order, patternToRegex, projections, resolveIdIfEntity, resolvePropertyValue, rlike, select, setUniqueResult, singleResult |
Creates a new query for the given registry, entity and criteria
registry
- The registryentity
- The entitycriteria
- The criteriaCreates a new query for the given registry, entity and criteria
registry
- The registryentity
- The entityjunction
- The junctionGet the list of native values to use in the query. This converts entities to ids and other types to their persisted types.
entity
- The entityin
- The criterionParse a query from a BsonReader into a DetachedCriteria
type
- The entity typequeryReader
- The query readerT
- The entity concrete type