Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 5ce6f1958dfdd9eebf5fe6cceafcc360f412cf4f (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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/*******************************************************************************
 * Copyright (c) 2005, 2015 IBM Corporation and others.
 *
 * This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License 2.0
 * which accompanies this distribution, and is available at
 * https://www.eclipse.org/legal/epl-2.0/
 *
 * SPDX-License-Identifier: EPL-2.0
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *     Semion Chichelnitsky (semion@il.ibm.com) - bug 208564
 *******************************************************************************/
package org.eclipse.core.runtime.preferences;

/**
 * Class which represents and preference filter entry to be used during preference
 * import/export (for example).
 *
 * @since 3.1
 * @see org.eclipse.core.runtime.preferences.IPreferenceFilter
 */
public final class PreferenceFilterEntry {

	private final String key;
	private String matchType;

	/**
	 * Constructor for the class. Create a new preference filter entry with the given
	 * key. The key must <em>not</em> be <code>null</code> or empty.
	 *
	 * @param key the name of the preference key
	 */
	public PreferenceFilterEntry(String key) {
		super();
		if (key == null || key.length() == 0)
			throw new IllegalArgumentException();
		this.key = key;
	}

	/**
	 * Constructor for the class. Create a new preference filter entry with the given
	 * key and match type. The key must <em>not</em> be <code>null</code> or empty.
	 * <p>
	 * Setting matchType to "prefix" treats the key as if it were a regular expression
	 * with an asterisk at the end. If matchType is <code>null</code>, the key must be
	 * an exact match.
	 * </p>
	 * @param key the name of the preference key
	 * @param matchType specifies key match type, may be <code>null</code> to indicate
	 * that exact match is required
	 * @since 3.3
	 */
	public PreferenceFilterEntry(String key, String matchType) {
		this(key);
		this.matchType = matchType;
	}

	/**
	 * Return the name of the preference key for this filter entry.
	 * It will <em>not</em> return <code>null</code> or the
	 * empty string.
	 *
	 * @return the name of the preference key
	 */
	public String getKey() {
		return key;
	}

	/**
	 * Return the match type specified for this filter. May return <code>null</code>
	 * to indicate that exact match is used.
	 * @return matchType the match type, might be <code>null</code> indicating that
	 * exact match is used
	 * @since 3.3
	 */
	public String getMatchType() {
		return matchType;
	}
}

Back to the top