Examples of EJValue


Examples of org.jboss.errai.marshalling.client.api.json.EJValue

    return msg;
  }


  public static List<Message> createCommandMessage(QueueSession session, HttpServletRequest request) throws IOException {
    EJValue value = JSONStreamDecoder.decode(request.getInputStream());
    if (value.isObject() != null) {
      return Collections.singletonList(from(getParts(value), session, request));
    }
    else if (value.isArray() != null) {
      EJArray arr = value.isArray();
      List<Message> messages = new ArrayList<Message>(arr.size());
      for (int i = 0; i < arr.size(); i++) {
        messages.add(from(getParts(arr.get(i)), session, request));
      }
      return messages;
View Full Code Here

Examples of org.jboss.errai.marshalling.client.api.json.EJValue

    }
  }


  public static List<Message> createCommandMessage(QueueSession session, InputStream inputStream) throws IOException {
    EJValue value = JSONStreamDecoder.decode(inputStream);
    if (value.isObject() != null) {
      return Collections.singletonList(from(getParts(value), session, null));
    }
    else if (value.isArray() != null) {
      EJArray arr = value.isArray();
      List<Message> messages = new ArrayList<Message>(arr.size());
      for (int i = 0; i < arr.size(); i++) {
        messages.add(from(getParts(arr.get(i)), session, null));
      }
      return messages;
View Full Code Here

Examples of org.jboss.errai.marshalling.client.api.json.EJValue

    }
  }

  public void doErraiMessage(final String message) {

    final EJValue val = JSONDecoder.decode(message);
    // this is not an active channel.
    try {
      if (queueSession == null) {
        queueSession = WebSocketNegotiationHandler.establishNegotiation(val, this, erraiService);
        if (queueSession != null) {
View Full Code Here

Examples of org.jboss.errai.marshalling.client.api.json.EJValue

    return msg;
  }


  public static List<Message> createCommandMessage(QueueSession session, HttpServletRequest request) throws IOException {
    EJValue value = JSONStreamDecoder.decode(request.getInputStream());
    if (value.isObject() != null) {
      return Collections.singletonList(from(getParts(value), session, request));
    }
    else if (value.isArray() != null) {
      EJArray arr = value.isArray();
      List<Message> messages = new ArrayList<Message>(arr.size());
      for (int i = 0; i < arr.size(); i++) {
        messages.add(from(getParts(arr.get(i)), session, request));
      }
      return messages;
View Full Code Here

Examples of org.jboss.errai.marshalling.client.api.json.EJValue

    Object demarshalledKey;
    final String assumedKeyType = ctx.getAssumedMapKeyType();
    final String assumedValueType = ctx.getAssumedMapValueType();
    for (final String key : o.isObject().keySet()) {
      final EJValue ejValue = o.isObject().get(key);
      if (key.startsWith(SerializationParts.EMBEDDED_JSON)) {
        final EJValue ejKey = ParserFactory.get().parse(key.substring(SerializationParts.EMBEDDED_JSON.length()));
        demarshalledKey = ctx.getMarshallerInstance(ctx.determineTypeFor(null, ejKey)).demarshall(ejKey, ctx);
        impl.put(demarshalledKey,
            ctx.getMarshallerInstance(ctx.determineTypeFor(null, ejValue)).demarshall(ejValue, ctx));
      }
      else {
View Full Code Here

Examples of org.jboss.errai.marshalling.client.api.json.EJValue

    if (o.isNull()) return null;

    final EJObject obj = o.isObject();

    if (obj != null) {
      final EJValue val = obj.get(SerializationParts.QUALIFIED_VALUE);
      return doDemarshall(val.isArray(), ctx);
    }
    else {
      return doDemarshall(o.isArray(), ctx);
    }
  }
View Full Code Here

Examples of org.jboss.errai.marshalling.client.api.json.EJValue

    if (array == null) return null;

    final String assumedElementType = ctx.getAssumedElementType();

    for (int i = 0; i < array.size(); i++) {
      final EJValue elem = array.get(i);
      if (!elem.isNull()) {
        String type = null;
        final EJObject jsonObject;
        if ((jsonObject = elem.isObject()) != null) {
          if (!jsonObject.containsKey(SerializationParts.ENCODED_TYPE)) {
            // for collections with a concrete type parameter, we treat the ^EncodedType value as optional
            type = assumedElementType;
          }
        }
View Full Code Here

Examples of org.jboss.errai.marshalling.client.api.json.EJValue

  }

  @Override
  public Date doNotNullDemarshall(final EJValue o, final MarshallingSession ctx) {
    if (o.isObject() != null) {
      final EJValue qualifiedValue = o.isObject().get(SerializationParts.QUALIFIED_VALUE);
      if (!qualifiedValue.isNull() && qualifiedValue.isString() != null) {
        return new Date(Long.parseLong(qualifiedValue.isString().stringValue()));
      }
      final EJValue numericValue = o.isObject().get(SerializationParts.NUMERIC_VALUE);
      if (!numericValue.isNull() && numericValue.isNumber() != null) {
        return new Date(new Double(numericValue.isNumber().doubleValue()).longValue());
      }
      if (!numericValue.isNull() && numericValue.isString() != null) {
        return new Date(Long.parseLong(numericValue.isString().stringValue()));
      }
    }

    return null;
  }
View Full Code Here

Examples of org.jboss.errai.marshalling.client.api.json.EJValue

    final EJObject jsonObject = o.isObject();
    if (jsonObject == null)
      return null;

    for (final String key : jsonObject.keySet()) {
      final EJValue v = jsonObject.get(key);
      if (!v.isNull()) {
        final String type = ctx.determineTypeFor(null, v);

        if (type == null) {
          impl.put(key, v.toString());
        }
        else {
          impl.put(key, ctx.getMarshallerInstance(type).demarshall(v, ctx));
        }
      }
View Full Code Here

Examples of org.jboss.errai.marshalling.client.api.json.EJValue

  }

  @Override
  public Long doNotNullDemarshall(final EJValue o, final MarshallingSession ctx) {
    if (o.isObject() != null) {
      final EJValue numValue = o.isObject().get(SerializationParts.NUMERIC_VALUE);

      if (numValue.isNumber() != null) {
        return new Double(numValue.isNumber().doubleValue()).longValue();
      }
      return Long.parseLong(numValue.isString().stringValue());
    }
    else {
      if (o.isNumber() != null) {
        return new Double(o.isNumber().doubleValue()).longValue();
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.