summaryrefslogtreecommitdiff
path: root/src/org/noreply/fancydress/directory/parser/DirectoryEntry.java
blob: c9e4e5040acde2491e2c2c557f7c6fb7b71d3401 (plain)
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
82
package org.noreply.fancydress.directory.parser;

/**
 * Hold one key/value pair in a directory.
 *
 * This class holds one key/value pair in a directory.  The
 * values themselves are still Strings, not parsed into
 * dates or octet strings.
 *
 * A <code>DirectoySection</code> is made up of entries like this.
 *
 * @see org.noreply.fancydress.directory.Directory
 * @see DirectoryParser
 * @see DirectoryMessage
 * @see DirectorySection
 */
public class DirectoryEntry {
	private String name;
	private String value;

	/**
	 * Default constructor.
	 *
	 * Creates a new DirectoryEntry.
	 *
	 * @param name name of the entry.
	 * @param value value of the entry.
	 */
	public DirectoryEntry(String name, String value) {
		this.name = name;
		this.value = value;
	}
	
	/**
	 * Copy constructor.
	 *
	 * Creates a new DirectoryEntry copying the data from <code>entry</code>
	 *
	 * @param entry entry to copy
	 */
	public DirectoryEntry(DirectoryEntry entry) {
		this.name = new String(entry.name);
		this.value = new String(entry.value);
	}

	/**
	 * Blint this value in order to verify or create a signature.
	 */
	public void blindValue() {
		value = "";
	};

	/**
	 * Returns a string representation of the directory.
	 *
	 * @return a string representation of the object.
	 */
	public String toString() {
		if (value.equals(""))
			return new String(name+":");
		else
			return new String(name+": "+value);
	}

	/**
	 * Returns the name of this section.
	 *
	 * @return name of this section.
	 */
	public String getName() {
		return name;
	}

	/**
	 * Returns the value of this section.
	 *
	 * @return value of this section.
	 */
	public String getValue() {
		return value;
	}
}