Exemplo n.º 1
0
 private static Object parseAttributeValue(String type, String value) {
   switch (type) {
     case "bool":
       return Boolean.parseBoolean(value);
     case "int":
       return Integer.parseInt(value);
     case "long":
       return Long.parseLong(value);
     case "float":
       return Float.parseFloat(value);
     case "double":
       return Double.parseDouble(value);
   }
   return value;
 }
Exemplo n.º 2
0
  public static void main(String[] args) {
    try {
      System.out.println(args[0] + " " + args[2]);
      ChatPublisher publisher = new ChatPublisher(args[0], args[1], Boolean.valueOf(args[2]));
      publisher.start();
      BufferedReader cmd = new BufferedReader(new InputStreamReader(System.in));

      while (true) {
        String s = cmd.readLine();

        if (s.equalsIgnoreCase("exit")) {
          publisher.stop();
          System.exit(0);
        } else {
          publisher.writeMessage(s);
        }
      }
    } catch (JMSException e) {
      e.printStackTrace();
    } catch (IOException e) {
      e.printStackTrace();
    }
  }