title: How to optimize intent usage in service with swich-case constraction
body: <p>I'm truying to optimize my service code with switch-case construction to avoid multiple if-else clauses, that make the code less readable. </p>
  
  <p>So, to use switch-case we need a condition (I mean "switch(){//some login}. </p>
  
  <p>Which condition should I use with intent object to simplify this code?</p>
  
  <pre><code>  @Override
          public int onStartCommand(Intent intent, int flags, int startId) {
              if (intent == null) {
                  return super.onStartCommand(intent, flags, startId);
              }
              if (intent.hasExtra(ChatManager.WS_CONNECT)) {
                  ChatManager.getInstance().start(chatCallbackConnect, false);
              } else if (intent.hasExtra(ChatManager.CHAT_CONNECT)) {
                  try {
                      String roomId = intent.getStringExtra(ChatManager.INTENT_EXTRA_ROOM_ID);
                      String roomIdRoomId = intent.getStringExtra(ChatManager.INTENT_EXTRA_ROOM_ID_ROOM_ID);
                      ChatManager.getInstance().getMessage(roomId, roomIdRoomId, chatCallbackMessage);
                  } catch (Exception e) {
                      log("ChatService. Exception: " + e);
                  }
              } else if (intent.hasExtra(ChatManager.MSG_SEND)) {
                  String message = intent.getStringExtra(ChatManager.MSG_SEND);
                  ChatManager.getInstance().sendMessage("topic/" + ChatManager.getInstance().getTopicId(), message);
              } else if (intent.hasExtra(ChatManager.ADD_USER)) {
                  String user = intent.getStringExtra(ChatManager.ADD_USER);
                  ChatManager.getInstance().addUser(user, chatCallbackAddUser);
              } else if (intent.hasExtra(ChatManager.CREATE_GROUP)) {
                  String group = intent.getStringExtra(ChatManager.CREATE_GROUP);
                  ChatManager.getInstance().createGroup(group, chatCallbackCreateGroup);
              } else if (intent.hasExtra(ChatManager.CHAT_DISCONNECT)) {
                  ChatManager.getInstance().disconnect();
                  stopSelf();
              }
  </code></pre>