org.chromium.sdk/src/org/chromium/sdk/internal/tools/ToolName.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;
       
     6 
       
     7 import java.util.HashMap;
       
     8 import java.util.Map;
       
     9 
       
    10 /**
       
    11  * Known ChromeDevTools protocol tool names.
       
    12  */
       
    13 public enum ToolName {
       
    14 
       
    15   DEVTOOLS_SERVICE("DevToolsService"),
       
    16   V8_DEBUGGER("V8Debugger"),
       
    17   ;
       
    18 
       
    19   private static final Map<String, ToolName> map =
       
    20       new HashMap<String, ToolName>();
       
    21 
       
    22   static {
       
    23     for (ToolName name : values()) {
       
    24       map.put(name.value, name);
       
    25     }
       
    26   }
       
    27 
       
    28   public static ToolName forString(String value) {
       
    29     if (value == null) {
       
    30       return null;
       
    31     }
       
    32     return map.get(value);
       
    33   }
       
    34 
       
    35   public final String value;
       
    36 
       
    37   private ToolName(String value) {
       
    38     this.value = value;
       
    39   }
       
    40 }