Commit | Line | Data |
---|---|---|
794df56d JRJ |
1 | /********************************************************************** |
2 | * Copyright (c) 2014 Ericsson | |
3 | * | |
4 | * All rights reserved. This program and the accompanying materials are | |
5 | * made available under the terms of the Eclipse Public License v1.0 which | |
6 | * accompanies this distribution, and is available at | |
7 | * http://www.eclipse.org/legal/epl-v10.html | |
8 | * | |
9 | * Contributors: | |
10 | * Jonathan Rajotte - Initial API and implementation | |
11 | **********************************************************************/ | |
12 | ||
13 | package org.eclipse.linuxtools.internal.lttng2.control.core.model; | |
14 | ||
15 | /** | |
16 | * Trace domain type enumeration. | |
17 | * | |
18 | * @author Jonathan Rajotte | |
19 | */ | |
20 | public enum TraceDomainType { | |
21 | /** Domain type : ust */ | |
22 | UST("ust"), //$NON-NLS-1$ | |
23 | /** Domain type : kernel */ | |
24 | KERNEL("kernel"), //$NON-NLS-1$ | |
25 | /** Domain type : jul */ | |
26 | JUL("jul"), //$NON-NLS-1$ | |
27 | /** Unknown domain type */ | |
28 | UNKNOWN("Unknown domain type"); //$NON-NLS-1$ | |
29 | ||
30 | private final String fInName; | |
31 | ||
32 | private TraceDomainType(String name) { | |
33 | fInName = name; | |
34 | } | |
35 | ||
36 | /** | |
37 | * Get the type's name | |
38 | * | |
39 | * @return The type's name | |
40 | */ | |
41 | public String getInName() { | |
42 | return fInName; | |
43 | } | |
44 | ||
45 | /** | |
46 | * Return the corresponding {@link TraceDomainType} of string miName | |
47 | * | |
48 | * @param miName | |
49 | * name of the Trace domain type to look for | |
50 | * @return the corresponding {@link TraceDomainType} | |
51 | */ | |
52 | public static TraceDomainType valueOfString(String miName) { | |
53 | if (miName == null) { | |
54 | throw new IllegalArgumentException(); | |
55 | } | |
56 | for (TraceDomainType tdType : TraceDomainType.values()) { | |
57 | if (tdType.getInName().equalsIgnoreCase(miName)) { | |
58 | return tdType; | |
59 | } | |
60 | } | |
61 | // Unknown domain | |
62 | return UNKNOWN; | |
63 | } | |
64 | } |