Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 4fea54f429a8e1111715749987daa6fe80507011 (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
/*******************************************************************************
 * Copyright (c) 2008 IBM Corporation 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:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.equinox.internal.security.storage.friends;

import java.util.Iterator;
import java.util.List;

/**
 * This class is used to pass description of a password provider module.
 */
public class PasswordProviderDescription {

	static final private String EMPTY_STRING = ""; //$NON-NLS-1$

	private int priority;
	private String id;
	private String name;
	private String description;
	private List hints;

	public PasswordProviderDescription(String name, String id, int priority, String description, List hints) {
		this.id = id;
		this.name = name;
		this.priority = priority;
		this.description = description;
		this.hints = hints;
	}

	public int getPriority() {
		return priority;
	}

	public String getId() {
		return id;
	}

	public String getDescription() {
		return (description == null) ? EMPTY_STRING : description;
	}

	public boolean hasHint(String hint) {
		if (hints == null)
			return false;
		for (Iterator i = hints.iterator(); i.hasNext();) {
			String candidate = (String) i.next();
			if (hint.equalsIgnoreCase(candidate))
				return true;
		}
		return false;
	}

	public String getName() {
		if (name == null || name.length() == 0)
			return id;
		return name;
	}
}

Back to the top