org.chromium.sdk/src/org/chromium/sdk/internal/tools/v8/DebuggerToolCommand.java
changeset 2 e4420d2515f1
equal deleted inserted replaced
1:ef76fc2ac88c 2:e4420d2515f1
       
     1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
       
     2 // Use of this source code is governed by a BSD-style license that can be
       
     3 // found in the LICENSE file.
       
     4 
       
     5 package org.chromium.sdk.internal.tools.v8;
       
     6 
       
     7 import java.util.HashMap;
       
     8 import java.util.Map;
       
     9 
       
    10 /**
       
    11  * Known V8Debugger tool commands.
       
    12  */
       
    13 public enum DebuggerToolCommand {
       
    14   ATTACH("attach"),
       
    15   DETACH("detach"),
       
    16   DEBUGGER_COMMAND("debugger_command"),
       
    17   EVALUATE_JAVASCRIPT("evaluate_javascript"),
       
    18 
       
    19   // Events
       
    20   NAVIGATED("navigated"),
       
    21   CLOSED("closed");
       
    22 
       
    23   private static final Map<String, DebuggerToolCommand> map =
       
    24       new HashMap<String, DebuggerToolCommand>();
       
    25 
       
    26   static {
       
    27     for (DebuggerToolCommand command : values()) {
       
    28       map.put(command.commandName, command);
       
    29     }
       
    30   }
       
    31 
       
    32   public final String commandName;
       
    33 
       
    34   private DebuggerToolCommand(String value) {
       
    35     this.commandName = value;
       
    36   }
       
    37 
       
    38   public static DebuggerToolCommand forName(String name) {
       
    39     if (name == null) {
       
    40       return null;
       
    41     }
       
    42     return map.get(name);
       
    43   }
       
    44 }