sdsu.util
Interface Stringizable

All Known Implementing Classes:
List, Table, LabeledData, LoggerMessage

public abstract interface Stringizable

An interface for objects that can convert itself to a string and "recreate" itself from that string. This interface is much more limited than Serializable. The few advantages Stringizable has over Serializable are: Stringizable works with Java 1.0.2, the string version of an object is readable and parsable by humans, and the string version of an object is ligher weight than in Serializable. The main use of Stringizable is for use in Java 1.0.2, motivate for students the utility of Serializable with less overhead, and for use in client-server programing where the strings must satisfy a protocol.
Version Info
1.1 Added metaData

Version:
1.1 30 August 1997
Author:
Roger Whitney (whitney@cs.sdsu.edu)
See Also:
Stringizer, SimpleTokenizer, TokenCharacters

Method Summary
 void fromString(java.lang.String objectString)
          Converts a string to an object.
 LabeledData getMetaData()
          Gets the meta data from the object.
 void setMetaData(LabeledData metaData)
          Sets the meta data for the object.
 java.lang.String toString()
          Converts the object to a string
 java.lang.String toString(java.lang.String header)
          Converts the object to a string with given header information.
 

Method Detail

fromString

public void fromString(java.lang.String objectString)
                throws ConversionException
Converts a string to an object. String must be created from object of same Class you are trying to recreate.
Throws:
ConversionException - If there is a problem converting to object.

setMetaData

public void setMetaData(LabeledData metaData)
Sets the meta data for the object. Each class can define the the meaning of meta data. For example in the class LabeledData, the meta data could be the characters used to separate name-value pairs, while the data will be the name-value pairs themselves Must contain the name-value pair "class=objectClassName"

getMetaData

public LabeledData getMetaData()
Gets the meta data from the object. See setMetaData.

toString

public java.lang.String toString()
Converts the object to a string
Overrides:
toString in class java.lang.Object

toString

public java.lang.String toString(java.lang.String header)
Converts the object to a string with given header information.