Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: e66a8be4ee6206f44b0617aa97d7811b107dcab7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*******************************************************************************
* Copyright (c) 2008 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
* 
* Contributors:
*     Oracle - initial API and implementation
*******************************************************************************/
package org.eclipse.jpt.eclipselink.core.context.persistence.customization;

/**
 *  Profiler
 */
public enum Profiler {
	performance_profiler, 
	query_monitor,
	no_profiler;

	// EclipseLink value string
	public static final String PERFORMANCE_PROFILER = "PerformanceProfiler"; //$NON-NLS-1$
	public static final String QUERY_MONITOR = "QueryMonitor"; //$NON-NLS-1$
	public static final String NO_PROFILER = "NoProfiler"; //$NON-NLS-1$

	// EclipseLink profiler class names
	public static final String PERFORMANCE_PROFILER_CLASS_NAME = "org.eclipse.persistence.tools.profiler.PerformanceProfiler"; //$NON-NLS-1$
	public static final String QUERY_MONITOR_CLASS_NAME = "org.eclipse.persistence.tools.profiler.QueryMonitor"; //$NON-NLS-1$

	/**
	 * Return the Profiler value corresponding to the given literal.
	 */
	public static Profiler getProfilerFor(String literal) {
		
		for( Profiler profiler : Profiler.values()) {
			if(profiler.toString().equals(literal)) {
				return profiler;
			}
		}
		return null;
	}
	
	
	public static String getProfilerClassName(String profilerValue) {
		if (profilerValue == PERFORMANCE_PROFILER) {
			return PERFORMANCE_PROFILER_CLASS_NAME;
		}
		if (profilerValue == QUERY_MONITOR) {
			return QUERY_MONITOR_CLASS_NAME;
		}
		return profilerValue;
	}
}

Back to the top