Package elemental.json

Examples of elemental.json.JsonArray


        return jsonArray;
    }

    private static JsonArray encodeCollection(Type targetType,
            Collection<?> collection, ConnectorTracker connectorTracker) {
        JsonArray jsonArray = Json.createArray();
        for (Object o : collection) {
            jsonArray.set(jsonArray.length(), encodeChild(targetType, 0, o, connectorTracker));
        }
        return jsonArray;
    }
View Full Code Here


        }
    }

    private static JsonArray encodeObjectMap(Type keyType, Type valueType,
            Map<?, ?> map, ConnectorTracker connectorTracker) {
        JsonArray keys = Json.createArray();
        JsonArray values = Json.createArray();

        for (Entry<?, ?> entry : map.entrySet()) {
            EncodeResult encodedKey = encode(entry.getKey(), null, keyType,
                    connectorTracker);
            EncodeResult encodedValue = encode(entry.getValue(), null,
                    valueType, connectorTracker);

            keys.set(keys.length(), encodedKey.getEncodedValue());
            values.set(values.length(), encodedValue.getEncodedValue());
        }

        JsonArray jsonMap = Json.createArray();
        jsonMap.set(0, keys);
        jsonMap.set(1, values);

        return jsonMap;
    }
View Full Code Here

        JSONSerializer serializer = customSerializers.get(value.getClass());
        return serializer.serialize(value, connectorTracker);
    }

    private static JsonArray toJsonArray(String[] array) {
        JsonArray jsonArray = Json.createArray();
        for (int i = 0; i < array.length; ++i) {
            jsonArray.set(i, array[i]);
        }
        return jsonArray;
    }
View Full Code Here

            throw new IllegalStateException(
                    "Can't call callback "
                            + name
                            + " on the client because a callback with the same name is registered on the server.");
        }
        JsonArray args = (JsonArray) JsonCodec.encode(arguments, null, Object[].class, null).getEncodedValue();
        connector.addMethodInvocationToQueue(
                JavaScriptCallbackRpc.class.getName(), CALL_METHOD,
                new Object[] { name, args });
    }
View Full Code Here

        MethodInvocation previousInvocation = null;
        // parse JSON to MethodInvocations
        for (int i = 0; i < invocationCount; ++i) {

            JsonArray invocationJson = invocationsJson.getArray(i);

            MethodInvocation invocation = parseInvocation(invocationJson,
                    previousInvocation, connectorTracker,
                    lastSyncIdSeenByClient);
            if (invocation != null) {
View Full Code Here

                connectorTracker.markAllConnectorsDirty();
            }
            return null;
        }

        JsonArray parametersJson = invocationJson.getArray(3);

        if (LegacyChangeVariablesInvocation.isLegacyVariableChange(
                interfaceName, methodName)) {
            if (!(previousInvocation instanceof LegacyChangeVariablesInvocation)) {
                previousInvocation = null;
View Full Code Here

        return (T) getValueForLiteral(nextUntilOneOf(STOPCHARS));
    }
  }

  JsonArray parseArray() throws JsonException {
     final JsonArray array = jsonFactory.createArray();
     int c = nextNonWhitespace();
     assert c == '[';
     while (true) {
       c = nextNonWhitespace();
       switch (c) {
         case ']':
           return array;
         default:
           back(c);
           array.set(array.length(), (JsonValue)nextValue());
           final int d = nextNonWhitespace();
           switch (d) {
             case ']':
               return array;
             case ',':
View Full Code Here

        return (T) getValueForLiteral(nextUntilOneOf(STOPCHARS));
    }
  }

  JsonArray parseArray() throws JsonException {
     final JsonArray array = jsonFactory.createArray();
     int c = nextNonWhitespace();
     assert c == '[';
     while (true) {
       c = nextNonWhitespace();
       switch (c) {
         case ']':
           return array;
         default:
           back(c);
           array.set(array.length(), nextValue());
           final int d = nextNonWhitespace();
           switch (d) {
             case ']':
               return array;
             case ',':
View Full Code Here

TOP

Related Classes of elemental.json.JsonArray

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.