Package cc.plural.jsonij

Examples of cc.plural.jsonij.Value


                Iterator<CharSequence> keySetIterator = jsonMap.keySet().iterator();
                while (keySetIterator.hasNext()) {

                    CharSequence keyValue = keySetIterator.next();
                    Value value = jsonMap.get(keyValue);

                    Object o = marshalJSONDocument(value, valueClass);
                    returnMap.put(keyValue, o);
                }

                return returnMap;

            } else {
                throw new RuntimeException("Beef this up");
            }
        }

        System.out.println(jsonMap);

        Iterator<CharSequence> keySet = jsonMap.keySet().iterator();
        while (keySet.hasNext()) {
            CharSequence key = keySet.next();
            Value v = jsonMap.get(key);


        }

View Full Code Here


            return new JSON.Array<JSON.Numeric>();
        }
        CycleDetector cycleDetector = new CycleDetector();
        JSON.Array<Value> marshaledArray = new JSON.Array<Value>();
        for (int i = 0; i < size; i++) {
            Value marshaledObject = marshalJavaObject(a[i], cycleDetector);
            if (marshaledObject != null) {
                marshaledArray.add(marshaledObject);
            } else {
                marshaledArray.add(JSON.NULL);
            }
View Full Code Here

    protected Value marshalAnyObject(Object o, CycleDetector cycleDetector) throws JSONMarshalerException {
        if (o == null) {
            return JSON.NULL;
        }
        Value marshaledObject = null;
        Class<?> objectClass = o.getClass();
        // Check for JSONCodec
        if (JSONMarshaler.CODEC_STORE != null && JSONMarshaler.CODEC_STORE.hasCodec(objectClass)) {
            JSONValueCodecStore.JSONValueCodecHelper codecHelper = JSONMarshaler.CODEC_STORE.getCodecHelper(objectClass);
            Value value = null;
            try {
                value = codecHelper.encode(o);
            } catch (IllegalAccessException ex) {
                Logger.getLogger(JavaMarshaler.class.getName()).log(Level.SEVERE, null, ex);
            } catch (IllegalArgumentException ex) {
View Full Code Here

        }
        return marshaledObject;
    }

    protected Value marshalJavaBoolean(Object o) {
        Value value = null;
        boolean marshaledBoolean = (Boolean) o;
        if (marshaledBoolean) {
            value = JSON.TRUE;
        } else {
            value = JSON.FALSE;
View Full Code Here

        }
        return value;
    }

    protected Value marshalJavaNumeric(Object o) {
        Value value = null;
        Number marshaledNumber = null;
        marshaledNumber = (Number) o;
        if (marshaledNumber != null) {
            value = new JSON.Numeric(marshaledNumber);
        } else {
View Full Code Here

        }
        return value;
    }

    protected Value marshalJavaEnum(Object o) {
        Value value = null;
        if (o != null) {
            String marshaledEnumeration = o.toString();
            value = new JSON.String(marshaledEnumeration);
        } else {
            value = JSON.NULL;
View Full Code Here

        }
        return value;
    }

    protected Value marshalJavaString(Object o) {
        Value value = null;
        String marshaledString = o.toString();
        if (marshaledString != null) {
            value = new JSON.String(marshaledString);
        } else {
            value = JSON.NULL;
View Full Code Here

        }
        return value;
    }

    protected Value marshalJavaArray(Object o, CycleDetector cycleDetector) throws JSONMarshalerException {
        Value value = null;
        if (o != null) {
            JSON.Array<Value> marshaledArray = new JSON.Array<Value>();
            int size = Array.getLength(o);
            Class<?> type = o.getClass();
            Class<?> componentType = type.getComponentType();
View Full Code Here

        }
        return value;
    }

    protected Value marshalJavaList(Object o, CycleDetector cycleDetector) throws JSONMarshalerException {
        Value value;
        if (o != null) {
            List<?> marshaledList = (List<?>) o;
            JSON.Array<Value> marshaledArray = new JSON.Array<Value>();
            Iterator<?> marshaledListIterator = marshaledList.listIterator();
            Object listItem = null;
View Full Code Here

        }
        return value;
    }

    protected Value marshalJavaMap(Object o, CycleDetector cycleDetector) throws JSONMarshalerException {
        Value value;
        if (o != null) {
            Map<?, ?> marshaledMap = (Map<?, ?>) o;
            JSON.Object<JSON.String, Value> marshaledObject = new JSON.Object<JSON.String, Value>();
            Iterator<?> keySetIterator = marshaledMap.keySet().iterator();
            while (keySetIterator.hasNext()) {
View Full Code Here

TOP

Related Classes of cc.plural.jsonij.Value

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.