de.tuberlin.cs.flp.jspwiki.plugin.wikiarchive
Class ArchiveEntryImpl

java.lang.Object
  extended byjava.util.Dictionary
      extended byjava.util.Hashtable
          extended byjava.util.Properties
              extended byde.tuberlin.cs.flp.jspwiki.util.PropertiesOrdered
                  extended byde.tuberlin.cs.flp.jspwiki.plugin.wikiarchive.ArchiveEntryImpl
All Implemented Interfaces:
ArchiveEntry, java.lang.Cloneable, java.lang.Comparable, java.util.Map, java.io.Serializable
Direct Known Subclasses:
ArchiveEntryBibTeX, ArchiveEntryPlaintext

public class ArchiveEntryImpl
extends PropertiesOrdered
implements ArchiveEntry

Default implementation of an ArchiveEntry. Extends a HashMap to allow storage of individual key/value-fields as entry content.

See Also:
Serialized Form

Field Summary
protected  java.lang.String name
           
protected  java.lang.String plaintext
           
protected  java.lang.String text
           
 
Fields inherited from class de.tuberlin.cs.flp.jspwiki.util.PropertiesOrdered
keysInOrder
 
Fields inherited from class java.util.Properties
defaults
 
Constructor Summary
ArchiveEntryImpl()
          Creates a new instance of ArchiveEntryImpl.
ArchiveEntryImpl(java.lang.String name)
          Creates a new instance of ArchiveEntryImpl.
ArchiveEntryImpl(java.lang.String name, java.util.Map m)
          Creates a new instance of ArchiveEntryImpl.
 
Method Summary
 int compareTo(java.lang.Object o)
          Compares the name This can be used for implenting a Comparator and using it to sort a list of entry names.
protected  boolean equalEntry(java.lang.String key, java.lang.String val1, java.lang.String val2)
           
 boolean equals(java.lang.Object o)
          Tests for equality of the whole entry.
 java.util.Map getMap()
           
 java.lang.String getName()
          Returns the name of the entry.
 java.lang.String getPlainText()
           
 java.lang.String getText()
           
 java.lang.String getValue(java.lang.String key)
          Gets a field's value.
 boolean isOptional()
          May be overwritten by subclass.
 void setName(java.lang.String name)
           
 void setPlainText(java.lang.String text)
           
 void setText(java.lang.String text)
           
 java.lang.String toString()
          May be overwritten by subclass.
 
Methods inherited from class de.tuberlin.cs.flp.jspwiki.util.PropertiesOrdered
elements, entrySet, getKeysInOrder, keys, keySet, load, put, remove, setKeysInOrder, values
 
Methods inherited from class java.util.Properties
getProperty, getProperty, list, list, propertyNames, save, setProperty, store
 
Methods inherited from class java.util.Hashtable
clear, clone, contains, containsKey, containsValue, get, hashCode, isEmpty, putAll, rehash, size
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

name

protected java.lang.String name

text

protected java.lang.String text

plaintext

protected java.lang.String plaintext
Constructor Detail

ArchiveEntryImpl

public ArchiveEntryImpl()
Creates a new instance of ArchiveEntryImpl.


ArchiveEntryImpl

public ArchiveEntryImpl(java.lang.String name,
                        java.util.Map m)
Creates a new instance of ArchiveEntryImpl.

Parameters:
name -
m - Map with default key/value-fields.

ArchiveEntryImpl

public ArchiveEntryImpl(java.lang.String name)
Creates a new instance of ArchiveEntryImpl.

Parameters:
name - The name of the entry.
Method Detail

getName

public java.lang.String getName()
Returns the name of the entry.

Specified by:
getName in interface ArchiveEntry
Returns:
The name.

setName

public void setName(java.lang.String name)
Parameters:
name -

getValue

public java.lang.String getValue(java.lang.String key)
Gets a field's value.

Parameters:
key - The field key.
Returns:
The value, or an empty string if the value as not been set. Never returns null.

getText

public java.lang.String getText()
Specified by:
getText in interface ArchiveEntry
Returns:

setText

public void setText(java.lang.String text)
Parameters:
text -

getPlainText

public java.lang.String getPlainText()
Specified by:
getPlainText in interface ArchiveEntry
Returns:

setPlainText

public void setPlainText(java.lang.String text)
Parameters:
text -

isOptional

public boolean isOptional()
May be overwritten by subclass.

Specified by:
isOptional in interface ArchiveEntry
Returns:

getMap

public java.util.Map getMap()
Specified by:
getMap in interface ArchiveEntry
Returns:

toString

public java.lang.String toString()
May be overwritten by subclass.

Returns:

compareTo

public int compareTo(java.lang.Object o)
Compares the name This can be used for implenting a Comparator and using it to sort a list of entry names. The comparison is performed case-insensitive.

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
o - An instance of ArchiveEntry to compare with based on the name.
Returns:
A value <0 if this entrie's name is to be sorted before the other entry,
0 if the names are equal,
a value >0 if this entrie's name is to be sorted behind the other entry.

equals

public boolean equals(java.lang.Object o)
Tests for equality of the whole entry. Unlike compareTo(), this compares all key/value-fields, too, not only the entry name.

Specified by:
equals in interface java.util.Map
Parameters:
o - Another instance of ArchiveEntryImpl to test for equality with.
Returns:
true if the entries and all their fields are equal, false otherwise.

equalEntry

protected boolean equalEntry(java.lang.String key,
                             java.lang.String val1,
                             java.lang.String val2)
Parameters:
key -
val1 -
val2 -
Returns: