summaryrefslogtreecommitdiff
path: root/src/org/noreply/fancydress/directory/parser/DirectoryEntry.java
diff options
context:
space:
mode:
authorPeter Palfrader <peter@palfrader.org>2003-10-09 11:41:45 +0000
committerPeter Palfrader <peter@palfrader.org>2003-10-09 11:41:45 +0000
commit566d17f731637df6828bdf32502a0fb123882dbe (patch)
treefc09fdfb90953134fa1d25f73367307502348a22 /src/org/noreply/fancydress/directory/parser/DirectoryEntry.java
parent018eea460ee32df1b70c40c2eca05f06c06daca5 (diff)
Initial import
Diffstat (limited to 'src/org/noreply/fancydress/directory/parser/DirectoryEntry.java')
-rw-r--r--src/org/noreply/fancydress/directory/parser/DirectoryEntry.java82
1 files changed, 82 insertions, 0 deletions
diff --git a/src/org/noreply/fancydress/directory/parser/DirectoryEntry.java b/src/org/noreply/fancydress/directory/parser/DirectoryEntry.java
new file mode 100644
index 0000000..c9e4e50
--- /dev/null
+++ b/src/org/noreply/fancydress/directory/parser/DirectoryEntry.java
@@ -0,0 +1,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;
+ }
+}