Package com.mongodb.util

Examples of com.mongodb.util.JSONCallback


        DBObject answer = null;
        try {
            byte[] input = IOConverter.toBytes(is);
           
            if (isBson(input)) {
                BSONCallback callback = new JSONCallback();
                new BasicBSONDecoder().decode(input, callback);
                answer = (DBObject) callback.get();
            } else {
                answer = (DBObject) JSON.parse(IOConverter.toString(input, exchange));
            }
        } catch (Exception e) {
            LOG.warn("String -> DBObject conversion selected, but the following exception occurred. Returning null.", e);
View Full Code Here


        DBObject answer = null;
        try {
            byte[] input = IOConverter.toBytes(is);
           
            if (isBson(input)) {
                BSONCallback callback = new JSONCallback();
                new BasicBSONDecoder().decode(input, callback);
                answer = (DBObject) callback.get();
            } else {
                answer = (DBObject) JSON.parse(IOConverter.toString(input, exchange));
            }
        } catch (Exception e) {
            LOG.warn("String -> DBObject conversion selected, but the following exception occurred. Returning null.", e);
View Full Code Here

        DBObject answer = null;
        try {
            byte[] input = IOConverter.toBytes(is);
           
            if (isBson(input)) {
                BSONCallback callback = new JSONCallback();
                new BasicBSONDecoder().decode(input, callback);
                answer = (DBObject) callback.get();
            } else {
                answer = (DBObject) JSON.parse(IOConverter.toString(input, exchange));
            }
        } catch (Exception e) {
            LOG.warn("String -> DBObject conversion selected, but the following exception occurred. Returning null.", e);
View Full Code Here

        DBObject answer = null;
        try {
            byte[] input = IOConverter.toBytes(is);
           
            if (isBson(input)) {
                BSONCallback callback = new JSONCallback();
                new BasicBSONDecoder().decode(input, callback);
                answer = (DBObject) callback.get();
            } else {
                answer = (DBObject) JSON.parse(IOConverter.toString(input, exchange));
            }
        } catch (Exception e) {
            LOG.warn("String -> DBObject conversion selected, but the following exception occurred. Returning null.", e);
View Full Code Here

    /**
     * Create a new parser.
     */
    public JSONParser(String s, BSONCallback callback) {
        this.s = s;
        _callback = (callback == null) ? new JSONCallback() : callback;
    }
View Full Code Here

        final Object[] params = parameters;

        // Parse the query with a callback that will weave in marshalled parameters
        DBObject dbo;
        try {
            dbo = (DBObject) JSON.parse(sb.toString(), new JSONCallback() {

                int paramPos = 0;

                @Override
                public Object objectDone() {
View Full Code Here

TOP

Related Classes of com.mongodb.util.JSONCallback

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.