Package com.erlang4j.internal.messages

Examples of com.erlang4j.internal.messages.MessageParser


      }

      @Override
      public void run() {
        if (message instanceof OtpErlangTuple) {
          MessageParser parser = new MessageParser();
          IBinding parsed = parser.parse(message, "{ConversationID, set, Sender, FieldName, {Type, Value}}");
          if (parsed.isValid()) {
            if (parsed.getAtom("Type").equals("var")) {
              OtpErlangObject valueE = parsed.getRaw("Value");
              Object value = null;
              if (valueE instanceof OtpErlangInt) {
                try {
                  value = ((OtpErlangInt) valueE).intValue();
                } catch (OtpErlangRangeException e) {
                  e.printStackTrace();
                }
              } else if (valueE instanceof OtpErlangString) {
                value = ((OtpErlangString) valueE).stringValue();
              } else if (valueE instanceof OtpErlangLong) {
                value = ((OtpErlangLong) valueE).longValue();
                if ((Long) value >= Integer.MIN_VALUE && (Long) value <= Integer.MAX_VALUE) {
                  value = new Integer(value.toString());
                }
              } else if (valueE instanceof OtpErlangDouble) {
                value = ((OtpErlangDouble) valueE).doubleValue();
              }
              if (value != null) {
                handlers.get(parsed.getAtom("FieldName")).Exec(value);
              }
            }
          } else {
            parsed = parser.parse(message, "{ConversationID, set_parent, Parent}");
            if (parsed.isValid()) {
              if (parsed.getRaw("Parent") instanceof OtpErlangTuple) {
                parentRef.set((OtpErlangTuple)parsed.getRaw("Parent"));
              }
            }
View Full Code Here

TOP

Related Classes of com.erlang4j.internal.messages.MessageParser

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.