From 566d17f731637df6828bdf32502a0fb123882dbe Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Thu, 9 Oct 2003 11:41:45 +0000 Subject: Initial import --- .../directory/parser/DirectoryEntry.java | 82 ++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 src/org/noreply/fancydress/directory/parser/DirectoryEntry.java (limited to 'src/org/noreply/fancydress/directory/parser/DirectoryEntry.java') 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 DirectoySection 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 entry + * + * @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; + } +} -- cgit v1.2.3