de.fu_berlin.ties.io
Class BaseStorable

java.lang.Object
  extended by de.fu_berlin.ties.io.BaseStorable
All Implemented Interfaces:
Storable
Direct Known Subclasses:
Accuracy, FeatureCount, FMetrics, Prediction

public abstract class BaseStorable
extends Object
implements Storable

Convenience implementations of the Storable interface that implements the toString() method based on the field map created by Storable.storeFields().

Classes that cannot extend this interface can easily implement this method by delegating to the static toString(Storable) method provided by this class, passing itself as argument and returning the result.

The Object.equals(java.lang.Object) and Object.hashCode() methods are not overwritten by this class because it would not only be inefficent, but also error-prone to do this based on the field map (e.g. a number could by represented either by a Number object or by a string representation, thus classes might be equal even if their field map serializations are not). Non-abstract Storable implementations should provide their own implementations of these methods, e.g. using the builder tools from Jakarta Commons Lang.

Version:
$Revision: 1.3 $, $Date: 2004/12/06 09:21:18 $, $Author: siefkes $
Author:
Christian Siefkes

Constructor Summary
protected BaseStorable()
          Creates a new instance.
 
Method Summary
 String toString()
          Returns a String representation of this object, printing all field name/value pairs in the order used to insert them into the FieldMap.
static String toString(Storable storable)
          Returns a String representation of a Storable object, printing all field name/value pairs in the order used to insert them into the FieldMap.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface de.fu_berlin.ties.io.Storable
storeFields
 

Constructor Detail

BaseStorable

protected BaseStorable()
Creates a new instance.

Method Detail

toString

public static String toString(Storable storable)
Returns a String representation of a Storable object, printing all field name/value pairs in the order used to insert them into the FieldMap.

Parameters:
storable - the storable to represent
Returns:
a string representation of the storable

toString

public String toString()
Returns a String representation of this object, printing all field name/value pairs in the order used to insert them into the FieldMap.

Overrides:
toString in class Object
Returns:
a string representation of this object


Copyright © 2003-2004 Christian Siefkes. All Rights Reserved.