Search in sources :

Example 26 with JsonParseException

use of org.bson.json.JsonParseException in project spring-data-mongodb by spring-projects.

the class ParameterBindingJsonReader method visitJavaScriptExtendedJson.

private void visitJavaScriptExtendedJson() {
    verifyToken(JsonTokenType.COLON);
    String code = readStringFromExtendedJson();
    JsonToken nextToken = popToken();
    switch(nextToken.getType()) {
        case COMMA:
            verifyString("$scope");
            verifyToken(JsonTokenType.COLON);
            setState(State.VALUE);
            currentValue = code;
            setCurrentBsonType(BsonType.JAVASCRIPT_WITH_SCOPE);
            setContext(new Context(getContext(), BsonContextType.SCOPE_DOCUMENT));
            break;
        case END_OBJECT:
            currentValue = code;
            setCurrentBsonType(BsonType.JAVASCRIPT);
            break;
        default:
            throw new JsonParseException("JSON reader expected ',' or '}' but found '%s'.", nextToken);
    }
}
Also used : EvaluationContext(org.springframework.expression.EvaluationContext) String(java.lang.String) JsonParseException(org.bson.json.JsonParseException)

Aggregations

JsonParseException (org.bson.json.JsonParseException)26 String (java.lang.String)19 Date (java.util.Date)4 SimpleDateFormat (java.text.SimpleDateFormat)3 DateFormat (java.text.DateFormat)2 ParsePosition (java.text.ParsePosition)2 Decimal128 (org.bson.types.Decimal128)2 MaxKey (org.bson.types.MaxKey)2 MinKey (org.bson.types.MinKey)2 BasicQuery (org.springframework.data.mongodb.core.query.BasicQuery)2 Query (org.springframework.data.mongodb.core.query.Query)2 TextCriteria (org.springframework.data.mongodb.core.query.TextCriteria)2 RepositoryQuery (org.springframework.data.repository.query.RepositoryQuery)2 ReturnedType (org.springframework.data.repository.query.ReturnedType)2 JsonNode (com.fasterxml.jackson.databind.JsonNode)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)1 SystemException (com.torodb.core.exceptions.SystemException)1 Calendar (java.util.Calendar)1 Map (java.util.Map)1