|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.ricebridge.data.sc.StringConverterSupport
com.ricebridge.data.sc.DefaultStringConverter
Convenience class for implementing the StringConverter interface quickly and easily.
The StringConverter interface requires that you handle the default
parameter option to the makeObject and makeString
methods. This means you have to check for errors and create a DataException reporting the error, or return the
default value. All this hard is done for you by the DefaultStringConverter class.
All you have to do is implement the makeObjectImpl(String)
and makeStringImpl(Object) methods, and you don't have to worry about handling the default option
at all.
The Source Code of this Java class is available under a BSD-style license.
| Constructor Summary | |
DefaultStringConverter()
|
|
| Method Summary | |
protected Object |
makeDefaultObjectImpl()
Return an empty string. |
protected String |
makeDefaultStringImpl()
Return an empty string. |
protected abstract Object |
makeObjectImpl(String pValue)
Implement this method to create an object based on a textual representation. |
protected Object |
makeObjectImpl(String pValue,
boolean pUseDefault)
Calls the simpler makeObjectImpl(String) method, and handles the default value automatically. |
protected abstract String |
makeStringImpl(Object pValue)
Implement this method to produce a textual representation of an object. |
protected String |
makeStringImpl(Object pValue,
boolean pUseDefault)
Calls the simpler makeStringImpl(Object) method, and handles the default value automatically. |
| Methods inherited from class com.ricebridge.data.sc.StringConverterSupport |
makeDefaultObject, makeDefaultString, makeObject, makeString |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public DefaultStringConverter()
| Method Detail |
protected Object makeObjectImpl(String pValue,
boolean pUseDefault)
throws Exception
makeObjectImpl(String) method, and handles the default value automatically.
makeObjectImpl in class StringConverterSupportExceptionStringConverterSupport.makeObject(java.lang.String, boolean),
StringConverter.makeObject(java.lang.String, boolean)protected Object makeDefaultObjectImpl()
Override this method if you need a different default object.
makeDefaultObjectImpl in class StringConverterSupportStringConverterSupport.makeDefaultObject(),
StringConverter.makeDefaultObject()
protected String makeStringImpl(Object pValue,
boolean pUseDefault)
throws Exception
makeStringImpl(Object) method, and handles the default value automatically.
makeStringImpl in class StringConverterSupportExceptionStringConverterSupport.makeString(java.lang.Object, boolean),
StringConverter.makeString(java.lang.Object, boolean)protected String makeDefaultStringImpl()
Override this method if you need a different default text.
makeDefaultStringImpl in class StringConverterSupportStringConverterSupport.makeDefaultString(),
StringConverter.makeDefaultString()
protected abstract Object makeObjectImpl(String pValue)
throws Exception
If an error occurs, just throw an Exception.
pValue - textual representation
Exception
protected abstract String makeStringImpl(Object pValue)
throws Exception
If an error occurs, just throw an Exception.
pValue - object
Exception
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||