Skip to main content
summaryrefslogtreecommitdiffstats
blob: 438175025bf65e1fe6fdd4a54a5664cefd6f452e (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
/*******************************************************************************
 * Copyright (c) 2004, 2008 Tasktop Technologies and others.
 * 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:
 *     Tasktop Technologies - initial API and implementation
 *******************************************************************************/

package org.eclipse.mylyn.internal.tasks.core;

import java.util.HashMap;
import java.util.Map;

import org.eclipse.core.runtime.Assert;

/**
 * @author Steffen Pingel
 */
public class AttributeMap {

	private final Map<String, String> attributes;

	public AttributeMap() {
		attributes = new HashMap<String, String>(4);
	}

	public String getAttribute(String key) {
		return attributes.get(key);
	}

	public Map<String, String> getAttributes() {
		return new HashMap<String, String>(attributes);
	}

	public void setAttribute(String key, String value) {
		Assert.isNotNull(key);
		if (value == null) {
			attributes.remove(key);
		} else {
			attributes.put(key.intern(), value.intern());
		}
	}

}

Back to the top