tmf: lttngControl: TraceEventType: valueOfString utility function
authorJonathan Rajotte Julien <jonathan.rajotte-julien@ericsson.com>
Tue, 5 Aug 2014 20:05:44 +0000 (16:05 -0400)
committerBernd Hufmann <bernd.hufmann@ericsson.com>
Wed, 27 Aug 2014 15:32:34 +0000 (11:32 -0400)
Fix style issues at the same time.
Change-Id: I98624dbfb80e5f6104bea9fb35ec5c8fe91fe2c3
Signed-off-by: Jonathan Rajotte Julien <jonathan.rajotte-julien@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/31065
Reviewed-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
Tested-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Tested-by: Hudson CI
org.eclipse.linuxtools.lttng2.control.core/src/org/eclipse/linuxtools/internal/lttng2/control/core/model/TraceEventType.java

index 26d89ce7b33638aaffdfc10c7fe3ff411e92b60e..f77e9201f45155c3e6d77cd623e1215d7003bcf4 100644 (file)
@@ -1,5 +1,5 @@
 /**********************************************************************
- * Copyright (c) 2012, 2013 Ericsson
+ * Copyright (c) 2012, 2014 Ericsson
  *
  * All rights reserved. This program and the accompanying materials are
  * made available under the terms of the Eclipse Public License v1.0 which
@@ -9,12 +9,11 @@
  * Contributors:
  *   Bernd Hufmann - Initial API and implementation
  **********************************************************************/
+
 package org.eclipse.linuxtools.internal.lttng2.control.core.model;
 
 /**
- * <p>
  * Trace event type enumeration.
- * </p>
  *
  * @author Bernd Hufmann
  */
@@ -24,7 +23,7 @@ public enum TraceEventType {
     /** Event type: syscall */
     SYSCALL("syscall"), //$NON-NLS-1$
     /** Event type: probe */
-    PROBE("probe"),  //$NON-NLS-1$
+    PROBE("probe"), //$NON-NLS-1$
     /** Event type: function */
     FUNCTION("function"), //$NON-NLS-1$
     /** Event type unknown */
@@ -44,5 +43,23 @@ public enum TraceEventType {
     public String getInName() {
         return fInName;
     }
-}
 
+    /**
+     * Return the corresponding {@link TraceEventType} of string miName
+     *
+     * @param name
+     *            name of the {@link TraceEventType} to look for
+     * @return the corresponding {@link TraceEventType}
+     */
+    public static TraceEventType valueOfString(String name) {
+        if (name == null) {
+            throw new IllegalArgumentException();
+        }
+        for (TraceEventType teType : TraceEventType.values()) {
+            if (teType.getInName().equalsIgnoreCase(name)) {
+                return teType;
+            }
+        }
+        return UNKNOWN;
+    }
+}
This page took 0.026232 seconds and 5 git commands to generate.