com.ricebridge.data.sc
Interface StringConverter

All Known Implementing Classes:
StringConverterSupport

public interface StringConverter

Convert an object into a String and back again.

This interface represents a general interface for converting objects into a well-defined textual representation, and for converting that textual representation back into an object instance.

When implementing your own StringConverter, you should extend the DefaultStringConverter class, as this handles errors and default values automatically.

The Source Code of this Java class is available under a BSD-style license.

See Also:
StringConverterSupport, DefaultStringConverter

Method Summary
 Object makeDefaultObject()
          Create a default instance of the object.
 String makeDefaultString()
          Create a default textual representation.
 Object makeObject(String pValue, boolean pUseDefault)
          Create an object from a textual representation.
 String makeString(Object pValue, boolean pUseDefault)
          Create a textual representation of an object.
 

Method Detail

makeObject

public Object makeObject(String pValue,
                         boolean pUseDefault)
Create an object from a textual representation.

If the String is invalid, then if the pUseDefault argument is true, return the default object, as returned by makeDefaultObject(), otherwise throw an Exception.

Parameters:
pValue - textual representation of the object
pUseDefault - use the default value in case of error

makeDefaultObject

public Object makeDefaultObject()
Create a default instance of the object.


makeString

public String makeString(Object pValue,
                         boolean pUseDefault)
Create a textual representation of an object.

If the object is invalid, then if the pUseDefault argument is true, return the default text, as returned by makeDefaultString(), otherwise throw an Exception.

Parameters:
pValue - object to convert
pUseDefault - use the default value in case of error

makeDefaultString

public String makeDefaultString()
Create a default textual representation.



Copyright © 2004-2005 Ricebridge