Examples of EJValue


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

      if (frame.getType() != FrameType.Text) {
        return;
      }
    }

    final EJValue val = JSONDecoder.decode(((TextFrame) frame).getText());
    // this is not an active channel.
    if (!activeChannels.containsKey(socket)) {
      final QueueSession queueSession =
              WebSocketNegotiationHandler.establishNegotiation(val, new SimpleEventChannelWrapped(socket), service);
     
View Full Code Here

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

      return null;

    Object demarshalledKey, demarshalledValue;
    for (String key : jsonObject.keySet()) {
      if (key.startsWith(SerializationParts.EMBEDDED_JSON)) {
        EJValue val = ParserFactory.get().parse(key.substring(SerializationParts.EMBEDDED_JSON.length()));
        demarshalledKey = ctx.getMarshallerInstance(ctx.determineTypeFor(null, val)).demarshall(val, ctx);
      }
      else {
        demarshalledKey = key;
      }

      EJValue v = jsonObject.get(key);
      if (v.isNull() == null) {
       demarshalledValue = ctx.getMarshallerInstance(ctx.determineTypeFor(null, v)).demarshall(v, ctx);
      }
      else {
        demarshalledValue = null;
      }
View Full Code Here

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

  @Override
  public final C demarshall(EJValue o, MarshallingSession ctx) {
    EJObject obj = o.isObject();
    if (obj != null) {
      EJValue val = obj.get(SerializationParts.QUALIFIED_VALUE);

      if (val.isNull() == null && val.isArray() != null) {
        return doDemarshall(val.isArray(), ctx);
      }
    }
    else if (o.isNull() == null && o.isArray() != null) {
      return doDemarshall(o.isArray(), ctx);
    }
View Full Code Here

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

    return o.isArray() != null;
  }

  protected <T extends Collection> T marshallToCollection(T collection, EJArray array, MarshallingSession ctx) {
    for (int i = 0; i < array.size(); i++) {
      EJValue elem = array.get(i);
      if (elem.isNull() == null) {
        collection.add(ctx.getMarshallerInstance(ctx.determineTypeFor(null, elem)).demarshall(elem, ctx));
      }
      else {
        collection.add(null);
      }
View Full Code Here

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

      }
    }

    @Override
    public String determineTypeFor(String formatType, Object o) {
      EJValue jsonValue = (EJValue) o;

      if (jsonValue.isObject() != null) {
        EJObject jsonObject = jsonValue.isObject();
        if (jsonObject.containsKey(SerializationParts.ENCODED_TYPE)) {
          return jsonObject.get(SerializationParts.ENCODED_TYPE).isString().stringValue();
        }
        else {
          return Map.class.getName();
        }
      }
      else if (jsonValue.isString() != null) {
        return String.class.getName();
      }
      else if (jsonValue.isNumber() != null) {
        return Double.class.getName();
      }
      else if (jsonValue.isBoolean() != null) {
        return Boolean.class.getName();
      }
      else if (jsonValue.isArray() != null) {
        return List.class.getName();
      }
      else if (jsonValue.isNull() != null) {
        return null;
      }
      throw new RuntimeException("unknown type: cannot reverse map value to concrete Java type: " + o);
    }
View Full Code Here

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

    return m;
  }

  @Override
  public String determineTypeFor(String formatType, Object o) {
    EJValue jsonValue = (EJValue) o;

    if (jsonValue.isObject() != null) {
      EJObject jsonObject = jsonValue.isObject();
      if (jsonObject.containsKey(SerializationParts.ENCODED_TYPE)) {
        return jsonObject.get(SerializationParts.ENCODED_TYPE).isString().stringValue();
      }
      else {
        return Map.class.getName();
      }
    }
    else if (jsonValue.isString() != null) {
      return String.class.getName();
    }
    else if (jsonValue.isNumber() != null) {
      return Double.class.getName();
    }
    else if (jsonValue.isBoolean() != null) {
      return Boolean.class.getName();
    }
    else if (jsonValue.isArray() != null) {
      return List.class.getName();
    }
    else if (jsonValue.isNull() != null) {
      return null;
    }
    else {
      return jsonValue.getRawValue().getClass().getName();
    }
  }
View Full Code Here

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

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

    for (String key : jsonObject.keySet()) {
      EJValue v = jsonObject.get(key);
      if (v.isNull() == null) {
        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 demarshall(EJValue o, MarshallingSession ctx) {
    if (o.isObject() != null && o.isNull() == null) {
      EJValue numValue = o.isObject().get(SerializationParts.NUMERIC_VALUE);
      if (numValue.isNull() != null) {
        return null;
      }
      return Long.parseLong(numValue.isString().stringValue());
    }
    else if (o.isString() != null) {
      return Long.parseLong(o.isString().stringValue());
    }
    else {
View Full Code Here

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

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

    for (String key : jsonObject.keySet()) {
      EJValue v = jsonObject.get(key);
      if (v.isNull() == null) {
        impl.put(key, ctx.getMarshallerInstance(ctx.determineTypeFor(null, v)).demarshall(v, ctx));
      }
      else {
        impl.put(key, null);  
      }
View Full Code Here

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

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

    for (String key : jsonObject.keySet()) {
      EJValue v = jsonObject.get(key);
      if (!v.isNull()) {
        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
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.